The domenuitem action was canceled

J

JOM

My form has an event procedure in the beforeUpdate as seen below... I have a
combobox on the same main form that has afterUpdate event. the thing is that
when I select the AcctDescrAvailable combox to select Yes/No, I have popup
that says select an account name which comes from the form's beforeupdate
procedure. So I press ok then then the runtime error 2501, the Domenuitem
action was cancelled.
If ypu press debug it points to the
DoCmd.DoMenuItem acFormBar, acEditMenu, acPaste, , acMenuVer70
Which is in the afterupdate procedure of that combobox ...

Any Help with this would be highly appreaciated....

***************beforeUpdate Procedure******************
If Me!AcctDecision.Column(1) = "Pending" Then
Debug.Print "Pending"
If IsNull(Me!AcctCode) Then
Debug.Print "AcctCode is null. Cancelling."
Cancel = True
strControl = strControl & "Select an Account Name" & vbCrLf
End If
End If
******************************************************

********************************************************
Private Sub AcctDescrAvailable_AfterUpdate()
Dim strARG As String
Dim strSQL As String
Dim DocName As String
Dim LinkCriteria As String
Dim Response As Integer
Dim Cancel As Boolean

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

If AcctDescrAvailable.Value = "No" Then
strARG = _
"Account Information, SELECT MailAddressLine1 as
AcctAddrLine1,MailAddressLine2 as AcctAddrLine2, propCity as AcctCity,
MailState as AcctState,MailZipCode as AcctZipCode FROM tblAcctInfor where
[AcctID] = " & AcctID & ";"
DocName = "frmAcctDescInput"
DoCmd.OpenForm DocName, , , LinkCriteria, , , strARG
Else
strSQL = "UPDATE tblAcctInfor SET MailAddressLine1, MailAddressLine2,
MailCity, MailState, MailZipCode= null where [AcctID] =" & AcctID & ";"
CurrentDb.Execute strSQL
End If

End Sub


***********************************************
The idea in this form is reffereing to the idea that I found in the
following website
http://www.rogersaccesslibrary.com/download3.asp?SampleName=OtherProblem.mdb
 
B

Brian Bastl

Hi JOM,

There may be another way to do what you want, but you'll need to describe
your needs in layman's terms.

Example:
I want to add a name to a combobox if it doesn't already exist. My combobox
is based on ....

Brian
 
J

JOM

Brian, based on the idea that I found in the following website
http://www.rogersaccesslibrary.com/download3.asp?SampleName=OtherProblem.mdb

My table has a borrowers address and the loan account's address and a field
AcctDescrAvailable which means is the loan account's address avaiable. (I
did not want have so much cluther on the form. as in have 2 address on the
form that is why I used AcctDescrAvailable which has values Yes,No, Unknown).


If the user selects No then the popup form pops up for the user to enter the
Loan Accounts address. If the user selects Yes, then the Loan Account
address will be updated with the Borrowers address., if unknown, then the
loan account address information will be left blank.

My form has before update event procedure which will not save the record if
certain information is missing, a popup will comeup informing the user to
enter the missing information.

The problem is that when I select the AcctDescrAvailable combox to select
Yes/No, I have popup that tells me that certain information on the form is
missing which comes from the form's beforeupdate procedure.
So I press ok then then the runtime error 2501, the Domenuitem action was
cancelled. If ypu press debug it points to the DoCmd.DoMenuItem acFormBar,
acEditMenu, acPaste, , acMenuVer70
Which is in the afterupdate procedure of that combobox ...

I hope this is understandable....

Brian Bastl said:
Hi JOM,

There may be another way to do what you want, but you'll need to describe
your needs in layman's terms.

Example:
I want to add a name to a combobox if it doesn't already exist. My combobox
is based on ....

Brian


JOM said:
My form has an event procedure in the beforeUpdate as seen below... I have a
combobox on the same main form that has afterUpdate event. the thing is that
when I select the AcctDescrAvailable combox to select Yes/No, I have popup
that says select an account name which comes from the form's beforeupdate
procedure. So I press ok then then the runtime error 2501, the Domenuitem
action was cancelled.
If ypu press debug it points to the
DoCmd.DoMenuItem acFormBar, acEditMenu, acPaste, , acMenuVer70
Which is in the afterupdate procedure of that combobox ...

Any Help with this would be highly appreaciated....

***************beforeUpdate Procedure******************
If Me!AcctDecision.Column(1) = "Pending" Then
Debug.Print "Pending"
If IsNull(Me!AcctCode) Then
Debug.Print "AcctCode is null. Cancelling."
Cancel = True
strControl = strControl & "Select an Account Name" & vbCrLf
End If
End If
******************************************************

********************************************************
Private Sub AcctDescrAvailable_AfterUpdate()
Dim strARG As String
Dim strSQL As String
Dim DocName As String
Dim LinkCriteria As String
Dim Response As Integer
Dim Cancel As Boolean

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

If AcctDescrAvailable.Value = "No" Then
strARG = _
"Account Information, SELECT MailAddressLine1 as
AcctAddrLine1,MailAddressLine2 as AcctAddrLine2, propCity as AcctCity,
MailState as AcctState,MailZipCode as AcctZipCode FROM tblAcctInfor where
[AcctID] = " & AcctID & ";"
DocName = "frmAcctDescInput"
DoCmd.OpenForm DocName, , , LinkCriteria, , , strARG
Else
strSQL = "UPDATE tblAcctInfor SET MailAddressLine1, MailAddressLine2,
MailCity, MailState, MailZipCode= null where [AcctID] =" & AcctID & ";"
CurrentDb.Execute strSQL
End If

End Sub


***********************************************
The idea in this form is reffereing to the idea that I found in the
following website
http://www.rogersaccesslibrary.com/download3.asp?SampleName=OtherProblem.mdb
 

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