Only Suppressing "Do you want to append XX records?" Warning?

Stang70Fastback

Registered User.
Local time
Today, 16:03
Joined
Dec 24, 2012
Messages
132
Hello all,

I have code that loops through a lot of objects, and adds them to a table. Right now I have suppressed the warnings via the DoCmd.Setwarnings = False command, in order to avoid the user seeing the message confirming that they want to make changes to the table.

However, I WOULD like them to see a warning if any of the table additions were unsuccessful for some reason. Is there a way to eliminate the user needing to confirm adding or modifying records, but NOT lose the warnings related to errors with adding these records? Even if it's a separate table that contains those warnings that they could look at afterward?

Thanks very much for your help!
 
Try using
Code:
DoCmd.Execute SQL, [options]

For SQL, you can use either a query name or a SQL string.
For options, use dbFailOnError

That should do what you want.
 
Brilliant! This seems to be exactly what I need. I shall do some more Googling to get a better understanding, and then work on changing my code. Thanks!
 
Yeah, one thing, I screwed it up.

You need to use CurrentDB.Execute, not DoCmd.Execute.

That's what I get for jumping to this thread immediately after working on a DoCmd.Transferspreadsheet thread!
 

Users who are viewing this thread

Back
Top Bottom