You will need to be a bit more specific here.
If you code:
Set rs = Currentdb.Openrecordset("SELECT DogID FROM Dogs")
you get an error if there is no table/query named Dogs, or of that table
does not contain a field named DogID. You can't recover from that error and
continue using the recordset: that would be meaningless.
Other errors occur if you try to move to a non-existent record, or a linked
table is disconnected, or you try to insert a record without supplying a
value for a required field, or you violate a validation rule or unique
index, or try to alter a foriegn key field to an invalid value, or ...
So, you need different approaches for different kinds of errors. The Error
event of the form catches the engine-level errors. The error handling in a
procedure handles other errors. The program options allow you to suppress
some confirmation messages, and SetWarnings handles some of those as well as
suppressing other things.
If you are talking about distinguishing confirmations and error warnings
when running action queries, this might help:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Bobby" <bo****@blueyonder.co.ukwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hi
I'm using Access 2003 with SQL server 2000, linked via ODBC.
Can anybody tell me how to capture SQL error codes in Access? If this
is not possible, is there any way I can simply turn off SQL errors?
Can I use docmd.setwarnings false? If so which event would I put it
on. On error doesn't seem to work.
Thanks
Colin