Stop a Macro depending on a query

  • Thread starter Thread starter juan
  • Start date Start date
J

juan

Hello,
I have a macro and would like to know if its possible to
stop the macro depending on my criteria of a query. Here's
what the macro do:
1.Imports a file
2.openquery - if my query results Null values in the
criteria field, then I want the macro to stop. But if
there are no null values, then I want the macro to
continue.
I'm not sure if this can be done.
Please advise any info.
Appreciate it.
Thanks,

juan
 
Juan,

It is not totally clear to me what you mean "if my query results Null
values in the criteria field". If it means if there are any records
returned by the query where the value of a field named Criteria is Null,
then...
1. There is no need to actually use an OpenQuery action, you can just
leave this out.
2. Add a StopMacro action to the macro, and in the Condition column for
this action, put the equivalent of...
DCount("*","YourQuery","[Criteria] Is Null")>0
 
Back
Top