If Statement

  • Thread starter Thread starter Rae
  • Start date Start date
R

Rae

I'm new to Access and am trying to combine some statements so as to populate
one field on a form instead of two separate fields. Can someone help me
create one IF statements to yield the results of either of these statements?

=IIf([ssa_ft_summer_enroll]="Y",-1,0)
=IIf([ssa_pt_summer_enroll]="Y",-1,0)

Thanks
 
I'm new to Access and am trying to combine some statements so as to populate
one field on a form instead of two separate fields.  Can someone help me
create one IF statements to yield the results of either of these statements?

=IIf([ssa_ft_summer_enroll]="Y",-1,0)
=IIf([ssa_pt_summer_enroll]="Y",-1,0)

Thanks

Dim MyResults as Integer
If [ssa_ft_summer_enroll]="Y" Then
MyResults = -1
Else
MyResults = 0
End if
 
trying to combine some statements so as to populate one field on a form
instead of two separate fields.
I do not understand your statement. How do you expect to 'populate one
field'?

An IIF statement evaluates whether something is true or not. It give one
answer if true and a different answer if false.

You can 'nest' IIF's like this -- IIF([X]>0, TrueResults, IIF([Y] <[X],
TrueResults, FalseResults))
 
Rae said:
I'm new to Access and am trying to combine some statements so as to
populate
one field on a form instead of two separate fields. Can someone help me
create one IF statements to yield the results of either of these
statements?

=IIf([ssa_ft_summer_enroll]="Y",-1,0)
=IIf([ssa_pt_summer_enroll]="Y",-1,0)


You want to do this as a ControlSource expression? And you want the result
to be True/-1 if either [ssa_ft_summer_enroll] or [ssa_pt_summer_enroll] =
"Y"? This should do the trick:

=IIf([ssa_ft_summer_enroll]="Y" Or [ssa_pt_summer_enroll]="Y",-1,0)
 
Worked beautifully! Thanks so much.
--
Rae


Dirk Goldgar said:
Rae said:
I'm new to Access and am trying to combine some statements so as to
populate
one field on a form instead of two separate fields. Can someone help me
create one IF statements to yield the results of either of these
statements?

=IIf([ssa_ft_summer_enroll]="Y",-1,0)
=IIf([ssa_pt_summer_enroll]="Y",-1,0)


You want to do this as a ControlSource expression? And you want the result
to be True/-1 if either [ssa_ft_summer_enroll] or [ssa_pt_summer_enroll] =
"Y"? This should do the trick:

=IIf([ssa_ft_summer_enroll]="Y" Or [ssa_pt_summer_enroll]="Y",-1,0)


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top