How to disable Access Built-in MsgBoxes ?

Ayas

New member
Local time
Today, 20:47
Joined
Apr 21, 2003
Messages
9
Are there any ways to disable Ms Access built-in msgboxes ?
They disturbed my database design...
 
When do you get the msgboxes?

One usually only has them where you chose to put one or as a way of displaying error messages. In both instances these are slected to be there by the developer.

If you get them during action queries, delete/update etc, you can turn them off either in code or as part of a macro

DoCmd.SetWarnings True.

If this is what you are after, ensure that you turn the warnings back on at the end of each module.
 
Depends on which msgboxes you are referring to, but you can always use the SetWarnings Action to no to turn all msgboxes off. This will eliminate them all once it is deactivated, but that could be problematic. What you would want to do is determine when these boxes are appearing, and what is triggering them. Once you know this, you can enter the code/macro and use the SetWarnings Action to prevent them from appearing, and then re-enable the SetWarnings Action at the end of the section of code or end of the macro.
If these are error messages appearing, you need to work on the error handling. Check into the current error handler and set the msgbox to display the error number. If you MDB works fine even though this error occurs (which it easily can) then put an IF statement in the code to bypass/ ignore that error in particular.
 
The msgbox like this...

I had a form to input my members club. I had made a command button to close the form. In the button I put a macro to close the form. I had tried to test the form by filling it with new data. If all fields were filled, it was oke, but if a primary key field left empty the msgbox appeared and asked me if I wanted to quit or not. If I clicked yes, the form closed, but if I clicked no another msgbox appeared and told me that the macro of closing form was halted...it was disturbing. How am I supposed to do ?:confused:
 
"if a primary key field left empty the msgbox appeared and asked me if I wanted to quit or not"

You cannot leave a primary key field blank, hence the error you are encountering. If you need to occasionally leave this field blank, I would recommend that it not be designated as the primary key. Could you assign an auto number field to the table and make that the primary key? If you could find a workaround for the assignment of the primary key, then you would not encounter this error.
However, if you want it to close w/o the field filled in, and then set the first line of the macro to Set Warnings to NO then the last line to Set Warnings YES. I don’t know if this will still allow what you are wanting, but it’s worth a try.
If that does not work, try converting the macro to code (TOOLS_MACROS_CONVERT MACROS) and in the error handler look for the line of code that says " MsgBox Err.Description". Change that to Err.Number, and run function again. When the message box appears, it will display a number instead of a description. Put an IF statement in the code to bypass the error message as such.

Exit_Command*_Click:
Exit Sub

Err_Command*_Click:
If Err.Number <> 2145 then
MsgBox Err.Description
Else
Resume Exit_Command6_Click
End IF
The * will be replaced by whatever you have assigned to your command button and the 2145 will be replaced by whatever Err.Number your system is generating.
 
Thanks, I'll try it

Thanks friend , I'll try it....
 

Users who are viewing this thread

Back
Top Bottom