×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to trap the Database Error and substitute it with the Mesgbox

How to trap the Database Error and substitute it with the Mesgbox

How to trap the Database Error and substitute it with the Mesgbox

(OP)
Hello.

When the forms are closed the access tryes to save the unsaved records entered, but if some fileds left null it will give an ODBC error. I would like to know if anyone konws how trapt the error and on wich even should I place the the undo command or some sort of MsgBox which would ask user to either complete the record entered or undo the last action and exit the application.  I would appreciate if you can help me.

Regards.

RE: How to trap the Database Error and substitute it with the Mesgbox

try the before_update event of the form, or the OnError event also.

Mohamed Aly
samara_79@hotmail.com

RE: How to trap the Database Error and substitute it with the Mesgbox

(OP)
Thanks
I tried both but the the error is raised by the MSSQL server.  MS Access Forms I have developed has been based on the MSSQL linked tables.  The errors are ODBC connection failed and cannot insert null value.  
  The mesages which I put are dispalyed but the the system errors continue to appear afterwards befor the form is closed and I am afraid it can be confusing for the back end user.  If you have delt with similar problem Can you give me more specific way to trap the error and sbustitue it with the meseage I want the user to see.

Ragards

RE: How to trap the Database Error and substitute it with the Mesgbox

There is a FAQ on this. I don't know if there is something special or different about an ODBC error, but this works for other error types. Go to the Access: General discussuib forum at this site, click on the FAQ tab at the top of the page, and look at:

"VBA and Custom Functions" category,
".Basic Error handling - hide an Access error message or substitute your own"

If this doesn't work, please post yur problem/solution here, we can then incorporate it into the FAQ.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close