Trapping SQL errors in VBA

J

John W. Vinson

ok... making progress on this relinking SQL tables routine. I was getting
wierd results before apparently because I was not passing a UID; it was using
my Windows logon (by default I guess) so automatically using a trusted
connection.

Now I've got another problem!

When I intentionally use an incorrect password, I get a popup window with

Connection Failed:
SQL State '01S00'
SQL Server Error: 0
<more lines of similar stuff>

but VBA does NOT detect an error.

Any idea how I can trap this error? Or is there some other way to test whether
a SQL uid/pwd is valid before I start the relinking process?

John W. Vinson [MVP]
 
Top