No results

C

cmichaud

I have a form that is providing parameters for a report.
It functions fine....sorta. I want to improve upon it.
Currently if there are no records that meet the criteria the report
comes up and has [error] in the field boxes. I would prefer at the form
view for it to tell the user that there is no record matches.

The report is mailing labels. The SQL query is rather long, as i am
rather imcompetent, and probably didnt design it as best as
possible....hence i wont post it right now if its not needed.

Here is the code behind the onclick event of the button on the form

On Error GoTo Err_SnailMail_Click
Dim stDocName As String

stDocName = "rptLabels"
DoCmd.OpenReport stDocName, acPreview

Exit_SnailMail_Click:
Exit Sub
Err_SnailMail_Click:
MsgBox Err.Description
Resume Exit_SnailMail_Click

Any ideas would be appreciated. thansk. c
 
K

Keith Wilby

I have a form that is providing parameters for a report.
It functions fine....sorta. I want to improve upon it.
Currently if there are no records that meet the criteria the report
comes up and has [error] in the field boxes. I would prefer at the form
view for it to tell the user that there is no record matches.

You can use the report's On No Data event to close the report (you will also
have to trap error 2501 IIRC).

Regards,
Keith.
www.keithwilby.com
 

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