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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form_Open Event

Status
Not open for further replies.

Boccle

Technical User
Feb 19, 2003
14
GB
Hi There,

I hope someone can help with the following problem....

I have the following code attached to the open event of a form:

Private Sub Form_Open (Cancel As Integer)
If Me!txtWasteProd = 0 Then
MsgBox "The answer is 0."
Cancel = True
Else
End If
End Sub

This works fine and does pretty much what I'd like it to, i.e. if the value in txtWasteProd is '0' then a Message box displaying the above message appears and the form does not open.

However, after my message box appears another one appears that says the following: " The OpenForm action was cancelled." I think this box might confuse users. Is there anyway to prevent access from displaying this message????

Thanks for any help.

Becca


 
Nope that doesn't appear to work.

Any other ideas??????
 
hmm.. works for me,

Private Sub Form_Open (Cancel As Integer)

DoCmd.setwarnings(False)

If Me!txtWasteProd = 0 Then
MsgBox "The answer is 0."
Cancel = True
Else
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top