ACC97: DoMenuItem Method Fails in a Modal Pop-up FormID: Q182435
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the DoMenuItem method in a form whose PopUp and Modal
properties are set to Yes, the action called by the DoMenuItem method may
fail silently or return the following error message:
NOTE: Some actions called by the DoMenuItem method also fail if you set the PopUp property of a form to Yes, regardless of whether or not the Modal Property is set to Yes.The command or action <action> isn't available now.
If you need to set the Modal and PopUp properties of a form to Yes, you can
replace the DoMenuItem method with the equivalent RunCommand method.
However, some DoMenuItem action commands do not have equivalent RunCommand
actions. For more information, search the Help Index for "DoMenuItem
action" and view the topic "DoMenuItem Action Commands Not Available
with the RunCommand Action."
The following steps demonstrate how to change actions of the DoMenuItem
method to the corresponding actions of the RunCommand method:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Microsoft has confirmed this to be a problem in Microsoft Access 97.
The Visual Basic for Applications code generated by the Command Button wizard often uses the DoMenuItem method.
For more information about converting DoMenuItem actions to RunCommand actions, search the Help Index for "DoMenuItem method."
Additional query words: pra
Keywords : FmsButb MdlAdrec WzProb
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 13, 1999