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!

cancelevent code acts different in access 2002

Status
Not open for further replies.

kkson

MIS
Dec 28, 2003
67
US
Hi, I made a db in access 2000 and when run in access 2002 i get an extra message box that says 'you canceled the previous operation'. I don't have that coded anywhere, 2002 is adding it, and I don't want it. I belevie it is the docmd.cancelevent that is causing it. Here is the code for the beforeupdate event:

If DCount("accountname", "tbldistribution", "accountname=forms!frmpublications!subfrmpublicationsdistro.form!cbxaccountname And accountletter=forms!frmpublications!subfrmpublicationsdistro.form!accountletter AND pubnum=forms!frmpublications!subfrmpublicationsdistro.form!pubnum") >= 1 And Me!chkNew = True Then
MsgBox "The sub-account: " & [cbxAccountName] & ", already exsist! If you want to enter more locations for the sub-account " & [cbxAccountName] & ", then please double click the exsisting entry and then add the other locations.", vbInformation, "ERROR, SUB-ACCOUNT EXSISTS"
Me.Undo
Me!chkNew = False
DoCmd.CancelEvent
Else
Me!chkNew = False
If IsNull(cbxAccountName) Then
MsgBox "There must be an Account listed in the sub-account field!", vbCritical, "ERROR, NO SUB-ACCOUNT"
Me!cbxAccountName.SetFocus
DoCmd.CancelEvent
ElseIf IsNull(QUANTITY) Or Me!QUANTITY = "" Or Me!QUANTITY = "0" Then
MsgBox "You must have a Quantity entered for the sub-account! Please enter a quantity.", vbCritical, "ERROR, QUANTITY NOT ENTERED"
Me!QUANTITY.SetFocus
DoCmd.CancelEvent
End If
End If
 
I see the error when checking for the Quantity. The rest of the code seems to work ok.
 
Okay, figured it out. Its the coding that follows this section. It does it in 2000 also. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top