Iif Statement

G

Guest

Apparently I'm not doing this right since it doesn't work so I was hoping to
get some help. I have a true/false field in a form. If another field (RSID)
meets certain criteria I want it to default to yes, otherwise, no. This is
what I used:

=IIf([tblProgram.RSID]="pre" Or "sei" Or "aid" Or "nur","true","false")

I put it in the Default Value of the true/false field. When I use though it
automatically defaults to true.

Sandra
 
G

Guest

There are a few problems with this. First, you don't reference a table field
value like that and you cant do the comparison as written. Also, if it is a
true/false field, putting the words true and false in quotes, the value
returned will be a string, not a boolean value. If tblProgram is the record
source for the form and RSID is a field in the table, then it should be bound
to a control on your form Then the code should be:

=IIf(Me.txtRSID ="pre" Or Me.txtRSID ="sei" Or Me.txtRSID ="aid" Or
Me.txtRSID ="nur",True,False)
 

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