if no data cancel event or run macro

hullstorage

Registered User.
Local time
Today, 15:05
Joined
Jul 18, 2007
Messages
213
Hi all, can somebody tell me to complete this task.

If I open a report and there is no data a message box appears
saying no data etc... ( which I have acheived )

What i want to happen is that if there is data then run a macro

many thanks
 
If [Your test] Then
' No data, do your thing here
Else
docmd.runmacro "MacroName"
end if
 
hmm, maybe I made a bad assumption.
How are you currently achieving your goal of displaying a message box if no data exists?
 
hmm, maybe I made a bad assumption.
How are you currently achieving your goal of displaying a message box if no data exists?


I use the "on no data" event of the reports properties
and then add the message box

regards

simon
 
1. Close the form on No Data event
2. Trap the 2501 error
3. Docmd.RunMacro "Nam_Of_Macro"

OR

1. DCount() how many records there in the form's recordset before calling the Docmd.OpenForm method
2. IF there are 0 records run the macro
3. IF there > 0 records, open the form.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom