tags:

views:

752

answers:

4

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?

A: 

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

A: 

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.

Lunatik
A: 

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

HardCode
Turning off warnings is terrible advice.
David-W-Fenton
Sure, if you look at it from such a simplistic view. Have you ever worked with Access? You can turn off warnings for an Access application so the "Are you sure you want to update N rows?" popups don't show. Then you can turn them on again. It's NOT terrible advice.
HardCode
+1  A: 

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
THEn