No Data

Pauldohert

Something in here
Local time
Today, 05:17
Joined
Apr 6, 2004
Messages
2,097
Is it more efficient to use the No Data event on a report to cancel it if it has no data, or is doing a DCount on the query before even attempting to open the report just as good.

Does using Dcount run the query twice ( one is actually opening the report) whereas the No data event only opens the query once??

Thanks Paul
 
Paul

I'm guessing, as I have never had the chance to test this, but I would say the No Data method.
...because the dCount has to actually count every time.

Tom
 
I always use the NoData event to Cancel. The only catch with this is that you must have "On Error Resume Next" on the cmdButton else you will get a "The Previous Action was cancelled" Error.
 
Thanks - I have changed all the reports to check for data in this way.
 
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo Err_Report_NoData

MsgBox "There is no data for this Quotation Printout. Canceling Print...", vbInformation, " Service Operations"
Cancel = True

Exit_Report_NoData:
Exit Sub

Err_Report_NoData:
MsgBox Err.Description, , " Service Operations"
Resume Exit_Report_NoData

End Sub
 
Cool - Never used this...

thxs
kh
 

Users who are viewing this thread

Back
Top Bottom