Access if/then statements?

Termnl

Junior Member
Nov 12, 2002
5
0
0
I have an Access 2000 database that I am trying to set up a query for....specifics aside, I need to know what the syntax is for pulling records out of the current field. Ex:

Push a button on a form that runs a macro.
The macro runs a series of if/then statements that accomplish this:
6 fields, all yes/no. For example, they are a, b, c, d, e, and f.
Only one box has a value of "yes".
there is another field called "type"
if field "a" in the particular record is set to "Yes", the "type" field of that record would be set to "a" when the macro is run.

This is sorta the flow im tryin to accomplish:

if (
![a]="Yes")
{
![type]="a"
}

Anyone know how to accomplish this in Access?
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,003
126
In a query you need to use the IIF function: IIf(expr, truepart, falsepart)

If you're using Visual BASIC you can use IF...THEN...ELSEIF...ENDIF blocks and chain them as long as you like:

IF expression then statement
ELSEIF expression
ELSEIF ...
...
END IF
 

Splitfyre

Member
Dec 13, 2002
44
0
0
Good product to use if you're wanting to report off that Access database is Crystal Reports 9. Plugs in to almost any database from what I've seen thus far.