Disabling msgbox in access

2019-07-07 08:30发布

问题:

I am trying to make a small form in MS Access 2003 SP3, I use some function that some other people made and these function has msgbox in it. I would like to disable msgbox while I am running the form. Is it possible in Access to disable msgbox?

回答1:

I created my finction called msgbox. Seems like its working. Thanks everyone for your help.

Public Function MsgBox(Prompt, Optional Buttons As VbMsgBoxStyle = vbOKOnly, Optional Title, Optional HelpFile, Optional Context) As VbMsgBoxResult

If myProcedureisRunning then 
    VBA.MsgBox Prompt
else
    debug.print prompt
endif
End Function


回答2:

If in fact these message boxes are produced from VBA code, then comment them out. However, if they are Access generated, such as the message box when inserting or updating records, you need to use the command DoCmd.SetWarnings False in order to suppress them. Just make sure to turn warnings off only when needed, then turn them back on. Otherwise, ALL message boxes from Access will be off, even in "design mode".



回答3:

Do a CTRL-F and find for MSGBOX and comment it. I guess that's the only way you can do it.



回答4:

Press Alt+F11 to open the Visual Basic IDE, then press CTRL+F to search. Type

msgbox
into the find, select "Replace" and type
'msgbox
into the "replace with" box (note the apostrophe). This will comment out all msgbox statements in the project.