If Statement

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
 
V

vbasean

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
 
K

KARL DEWEY

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))
 
D

Dirk Goldgar

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)
 
R

Rae

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top