IF/Then Statement in a Macro

  • Thread starter Thread starter Beverly76
  • Start date Start date
B

Beverly76

I would like my macro to lookup a value in a table and if "Y", continue the
macro and if "N", open a form instead. I would like to use this as the
mechanism to redirect users from accessing files at the time they are being
updated.

The table would only have one record with one field that is "Y" or "N".

Please help.
 
Use the Condition column to handle this:

Condition: DLookup("FieldNameInTable", "TableName") = "N"
Action: OpenForm
< rest of open form arguments >

Condition: ...
Action: StopMacro

Condition: < blank >
Action: < next step of macro to be run if the DLookup function
returns a Y value)

Note the three dots in the second action. Those three dots tell ACCESS that
that step also is to be run if the condition in the previous step is true.
The "blank" entry in the third line's Condition box tells the macro to start
with that step if the condition in the first step is false.
 
Back
Top