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
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