Warning: Creating default object from empty value in /homepages/42/d301471907/htdocs/wp-includes/functions.php on line 334
C l e a r G l a s s ~ Blog » Conditional Statements with MS Access
CG Rotating Images

Welcome to C l e a r G l a s s

Conditional Statements with MS Access


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /homepages/42/d301471907/htdocs/wp-includes/functions-formatting.php on line 76

How do you do conditional if (), else if(), else statements in MS Access for the control source using the Expression Builder?

Here is the format:

=IIf(condition, true, false)

Example 1:

=IIf([isOfficer]="0","Non-Officers","Officers")

Pseudocode:

If (isOfficer = "0") Then
 Print “Non-Officers”
Else
 Print “Officers”
End If

Example 2:

What if you want to add another conditional statement? The only solution is to nest another IIf() function in the False part of the Condition.
=IIf([isOfficer]="0","Non-Officers",IIf([isOfficer]="-1","All Officers","Both"))

Pseudocode:

If (isOfficer = "0") Then
 Print “Non-Officers”
Else If (isOfficer = “-1″) Then
 Print “All Officers”
Else
 Print “Both”
End If

— admin @ 9:15 am 8/5/2005

Comments »

The URI to TrackBack this entry is: http://www.clearglass.net/wp-login.php/wp-admin/wp-images/smilies/wp-admin/blog.php/wp-trackback.php/11

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)

(required)


ClearGlass LLC © 2009-2011. All rights reserved.