stop macro when query is empty

G

Guest

I have a form (showing one record at a time) that asks the user for input.
After the user puts in the information, they click on a button that starts a
macro. That macro sets a true/false box which removes the current record
from the select query criteria. The macro then reopens this same form asking
for user input on the next record.

When the query no longer has a records to display in the form, the macro
crashes and I have to manually clear the errors. Can someone please help me
with code or macro condition settings that will stop my macro of there are no
more records in the query.

Thanks in advance!
 
S

Steve Schapel

BLTibbs,

The equivalent of this in the Condition of the macro...
DCount("*","NameOfYourQuery")>0
 
G

Guest

That didn't work. Do I have to use a 'stop macro' command next to that
condition.. or why didn't that work? Now, I am getting the end macro error
before all of my records are out of the query.
 
G

Guest

Steve,

Thanks for your re-reply, but I figured it out. I had two instructions for
my macro and once I put your condition expression in front of both
instructions, my problem was solved.

Thanks again.
 

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