Conditional Step in a Macro

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

Beverly76

Using my switchboard, I would like to prevent users from running reports at
the same time as the underlying data tables are being updated. The way I
would like to prevent this is to include a step in my macro that checks a
data table value for a "STOP" command, before continuing to open queries or
reports.

Basically, the person updating the tables would click a button on a form
which would change the value of a table to keep other users from being able
to run the action macros, and uncheck the box after the update.

How do I add an "if/then" statement in a macro? How do I reference a
Table.Field value in a macro. If [STOP]![ACTION](row 1)="Y", open form
"PLEASE TRY AGAIN LATER", otherwise, open report X.
Sincerely,
Beverly76
 
Beverly,

You would use a Condition in the macro. It is not 100% clear to me what
you mean, but here is an example of a macro Condition statement:
DCount("*","YourTable","[Stop]=-1")=0

This will enable the macro action (e.g. OpenReport) if there are no
records in the table where the Stop field is Yes (assumes Stop is Yes/No
data type).
 
Back
Top