error trap the query that a report is based on? (1 Viewer)

p0welly

Registered User.
Local time
Today, 21:09
Joined
Aug 26, 2004
Messages
38
Im trying to produce an account statement, detailing the activity between 2 dates and then giving some totals at the bottom.

The report is based on a query, this lists all the transactions, and then at the bottom I have a number of dsums that calculate total payments etc

However I have a problem if the query finds no data, if there are no transactions between the dates I get a #error where the transactions would be (not supprising really)

however this caused the code on the report to fail and the dsums end up calculating the total values of all transactions not just the ones related to this report.

Can I error trap the query so that if there is no data the report shows some text and continues to run the code?

Thanks in advance
 

spacepro

Registered User.
Local time
Today, 21:09
Joined
Jan 13, 2003
Messages
715
I tend to trap reports and display a messagebox when there is no data.

On the Report_NoData Event

Code:
msgbox "No Data Available",vbinformation,"Cancelling Report.."
cancel = true

However you can trap it on this event by doing what action you like.

Andy
 

Users who are viewing this thread

Top Bottom