docmd.setwarnings false
Hmm, while ranman256 is correct, I would be careful about shutting them off (and don't forget to turn back on DoCmd.SetWarnings True) as if there is a legitimate message it too will be stifled.
You can also test for certain error messages and take an action you control.
See this by PBaldy.
I would not blindly/unconditionally suppress error messages
you can also use the
currentdb.execute (SQL statement here)
this doesn't pop up with append errors when you run it but functions exactly like an append query otherwise, in other words it won't overwrite existing indexed records (either by primary key or unique key field(s))
The previous suggestion also means no error messages will appear of any kind
Better still use Currentdb.Execute (SQL statement here), dbFailOnError
This will run all your action queries without messages BUT if the query fails it will display an error message
Personally I would use the above together with proper error handling like that in the link supplied by orange
Thank you for a great suggestion. I think this is exactly what I'm looking for. Normally, I would change my code to avoid the error altogether. However, I know what is causing it. The table has separate fields for dates and times instead of date/time fields. For this application I cannot combine them into date/time fields. Even though the error pops up the record gets saved properly, without nulls. "If it ain't broke don't fix it."
Thanks again.
Please explain.For this application I cannot combine them into date/time fields.