Message when No Data

K

Kitty

I have an option group with a bunch of radio buttons. The
buttons correspond to different options for extracting
records - if the user clicks the delinquent account radio
button, the next form is populated with all accounts that
are delinquent.

Sometimes, there aren't any. In that case, a blank form
appears with no indication no data meets whatever criteria
they selected from the option group.

Is there something, similar to the On No Data Report
event, where I can pop up a message box telling them there
are no accounts? While most users know a blank form means
there aren't any, occaisionally the form is blank because
of a problem. I'd like them - and me - to know the
difference.

Any suggestions will be appreciated.

Thanks!

Kitty
 
V

Van T. Dinh

Since the Form's Recordset is available in the Form_Open Event, you can use
this Event to check the RecordCount. If RecordCount = 0, you can post a
MsgBox on screen and then Set the Cancel argument (of the Open Event) to
True to cancel the opening / loading of the Form.
 
K

Kitty

Thanks. I did something similar to this, and it works
(looked at the recordset).

Re: Peter's comment about canceling causing an error, it
hasn't in my testing. I do capture that error in opening
reports that have no data.

Kitty
 

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