Help with error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings all. I am using adp with SQL 2k on the backend. I am using
windows integrated security to set permissions. Presently, when someone gets
an error that says they do not have permission to insert or update into a
record they will hit ok, but the changes they have made do not go away, and
the error message keeps recurring. Even if the record is manually changed to
its original state the message keeps coming back. As it is now they have to
close the form and come back to it to begin using it again. Is there a way
to return the record to its original state after the user hits OK on the
first error message?
 
I don't use adp's, but with an mdb file you press Esc once to undo the last
control and Esc a second time to undo all the changes to the current record.
Once the record isn't dirty the error should quit.

You may also be able to trap this error in the form's Error event then
provide your own error dialog that gives the user the option to undo their
changes. If so, the code to undo the changes would be Me.Undo.
 
Greg Snidow said:
Greetings all. I am using adp with SQL 2k on the backend. I am using
windows integrated security to set permissions. Presently, when someone
gets
an error that says they do not have permission to insert or update into a
record they will hit ok, but the changes they have made do not go away,
and
the error message keeps recurring. Even if the record is manually changed
to
its original state the message keeps coming back. As it is now they have
to
close the form and come back to it to begin using it again. Is there a
way
to return the record to its original state after the user hits OK on the
first error message?

Have you tried the ESC key?

Keith.
www.keithwilby.com
 
Wayne, hitting esc works liks a charm. Is there a way to make the form do
whatever escape does when the user hits the OK on the error message? Also,
where can I find the forms Error event? I looked through all the properties
but could not find it.
 
A form in an MDB file has an Error event to trap errors such as this one. I
just created an ADP file to check, and the Error event is there also. Open
the form in design view, open the form's Properties and go to the Events
tab. You should see On Error below the Key Preview option, it's about 3/4th
of the way down the list.

I'm using Access 2003, so if you have a newer version, this may be
different. Set On Error to [Event Procedure] and click the ... button that
appears to the right of the box to take you into the procedure. Once you're
there, start off by putting a message box in the code to find what error
code you're looking for:

Example:
MsgBox "The error code is " & DataErr

Once you know the error code that is returned by the error in question, you
can trap it and handle it yourself.

Example:
If DataErr = <the number returned above> Then
Msgbox "You don't have the permissions to make this change. Click Ok to
Undo the changes.", vbOkOnly + vbExclamation
Me.Undo
End If
 
Back
Top