Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On no Data Event for Form??? 1

Status
Not open for further replies.

perfectchaoss

Programmer
Nov 6, 2002
44
US
Hi,
I have a form that is linked to a table with field Status. The purpose of the form is to have a short list of "Active" orders that have already been entered. Once the status is changed by the user it becomes inactive and will be viewable through another form. When I inactivate the last active record and I try to re-open I get the error...

"You have entered an expression that has no value"

Because there is no data for the form. Instead of the error message, I want an message box to tell the user:

MsgBox "There are no active orders. Please enter a new order."
then send them back to the switch board.

I know reports have a on no Data event procedure, do forms have something similar??? I have tried a few work arounds. Like checking for IsNull() on some of the fields. I havent had any success.

thanks,
JF
 

In the Form_Open event do a DCount on the same query as the forms recordsource. If this is 0, display a message informing the user that there are no active orders, then set Cancel = true. This will prevent the form from opening.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top