What to do if no search results from query input to a form

M

Martin

I have a form that extracts data from a few tables, the search being
performed by a query. The input parameter to this query comes from a form
with a combo dropdown which allows for a particular type of item to be
searched for in the database.

This will return the stock ids for each item of that type and is the source
for the form that displays the results.

My question is, what do I have to do to put up an info box for 'No items
found on the database' out as a display to the operator.

Should I have an event in the form that provides the parameter source for
the query, or should I be using something in the results display form. In
each case, which event should I be using?

TIA
Martin
 
A

Albert D. Kallal

Add a error trap, or error handling to the button code that launches the
report.

You can simple change:

docmd.Openreport "your report",acviewPreview

To:

on error resume next
docmd.Openreport "your report",acviewPreview


Then, in the report on-no data event, smply put:

msgbox "no data for this reprot"
cancel = True
 
M

Martin

Thanks for the response, but I cannot find the "no data event" that you
reference. I am using Access 97 if that makes a difference. I tried adding
it to the "on error" event, but that did not work.
Also, I am displaying the results of the query in a form, not a report.

Martin
 

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