suppress warning message in Access

  • Thread starter Joe E via AccessMonster.com
  • Start date
J

Joe E via AccessMonster.com

Hello,

I have written a VBA macro to automatically import an XML file into Access
2003. The import works fine, but it gives me a pop-up error message that I
want to automatically close.

The message box that comes up says, "Not all of your data was successfully
imported. Error descriptions with associated row numbers of bad records can
be found in the Microsoft Office Access table 'ImportErrors'." It also has a
single "OK" button. Does anyone know of any code I can put in my macro to
automatically close this message box after it pops up, or better yet prevent
the message box from appearing?

Thanks,
Joe
 
S

SacCourt

DoCmd.SetWarnings False

I learned this on the boards.

From Help Menu.

SetWarnings Method
See AlsoApplies ToExampleSpecificsThe SetWarnings method carries out the
SetWarnings action in Visual Basic.

expression.SetWarnings(WarningsOn)
expression Required. An expression that returns one of the objects in the
Applies To list.

WarningsOn Required Variant. Use True (–1) to turn on the display of
system messages and False (0) to turn it off.

Remarks
For more information on how the action and its argument work, see the action
topic.

If you turn the display of system messages off in Visual Basic, you must
turn it back on, or it will remain off, even if the user presses CTRL+BREAK
or Visual Basic encounters a breakpoint. You may want to create a macro that
turns the display of system messages on and then assign that macro to a key
combination or a custom menu command. You could then use the key combination
or menu command to turn the display of system messages on if it has been
turned off in Visual Basic.

Example
The following example turns the display of system messages off:

DoCmd.SetWarnings False
 
J

Joe E via AccessMonster.com

I tried that and it did NOT work. My Access object is called appAccess and I
tried both..
AppAccess.doCmd.setWarnings False

and i tried...
AppAccess.Application.doCmd.setWarnings False

Neither of these worked. I placed this code before the actual XML import
code and the message box still appeared.

Any other ideas? If I could automatically have VBA hit the Enter key, that
would do the trick, but I don't know how to do this either.

Please help!
Joe E
 
S

SacCourt

I use in VB Code
doCmd.setWarnings False

above the VB Code that produces the message.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top