Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Error Handling

Status
Not open for further replies.

DaveTappenden

Programmer
Jan 16, 2002
21
0
0
I have just upsized an Access 2000 application to SQL v7 using the upsizing wizard.

On the Server side, I have set check constraints on certain colums (eg discount<40) to validate data entry.

This works fine on my access forms, but the users are getting an unfriendly ODBC call failed error message when they enter data that violates the constraint rule. My normal access error trapping routine is not triggered.

Can anyone advise me on the correct error-handling routine to trap ODBC errors?

Thanks in advance.
 
Dave,
Are your data-entry forms bound? If so, I highly recommend you go with unbound and use raw sql to populate/update the data. This way, you have control over those messages, which you can trap on the .execute call which should replace a bound form's Update.

If they are not bound, how are you updating and when does the error occur?
--jsteph
 
Most of my forms are bound. Does this mean that I am unable to trap the ODBC errors?
The only unbound forms I use are search forms that create the queries which the forms are based on.
If needed, I could convert to unbound and introduce the db.execute method as you suggest, but I have over 50 forms in my application!
 
Dave,
You should be able to trap the odbc errors in the Form's Error event.

But even though, for long-term robustness, unbound is the only way to go.
--jsteph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top