Error message make over (1 Viewer)

VBAhole22

Registered User.
Local time
Today, 09:28
Joined
Jan 18, 2002
Messages
117
I am writing an Access front end to a db that resides on SQL Server. My problem is that when a user tries to enter a record that violates ref integrity on the server I get an enigmatic SQL Server error message that is baffling. How can I trap the error beforehand, avoid the SQL message, make a message of my own, and void the action? This typically occurs when the user tries to tab into the subform thus entering the record on the main form with an identical primary key as a pre-exisiting record.:D
 

ghudson

Registered User.
Local time
Today, 09:28
Joined
Jun 8, 2002
Messages
6,195
Are you getting an error number? If so, you can easily trap that error and replace the Access error message with your own message and action each time the user causes that error (number).

HTH
 

VBAhole22

Registered User.
Local time
Today, 09:28
Joined
Jan 18, 2002
Messages
117
Well my issue is that I am getting SQL error messages. I would like to get Access error messages so I could trap them. What I'm unsure about is if I need to develop a whole layer of error checking before the record is submitted to SQL server.

For instance, if a user tried to add a new record with a primary key that was the same as a pre-existing record would I:
a) run an SQL query from within Access before submitting the record to SQL Server to see if it is legimate
b)let the record be submitted but be prepared to accept the results as either : it worked or it didn't work and here is why.

I'm unsure which of the above options to use and I'm even more unsure of how to do either one.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:28
Joined
Feb 19, 2002
Messages
43,352
See the following article in the knowledge base:

Q209855 - ACC2000 How to Trap Specific ODBC Error Messages
 

Users who are viewing this thread

Top Bottom