Disabling msgbox in access

2019-07-07 08:20发布

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?

4条回答
叼着烟拽天下
2楼-- · 2019-07-07 09:02

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.

查看更多
祖国的老花朵
3楼-- · 2019-07-07 09:06

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

查看更多
姐就是有狂的资本
4楼-- · 2019-07-07 09:21

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
查看更多
forever°为你锁心
5楼-- · 2019-07-07 09:21

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

查看更多
登录 后发表回答