Run-time error '3107'

xaysana

Registered User.
Local time
Today, 17:53
Joined
Aug 31, 2006
Messages
94
Hi there,
I am having problem with readonly user loged into form data, when he tries to change or update record. it appears run-time error '3107' and many other error messages as he clicks different command buttons.

What i would like to do is:

If run-time error = 3107 then
MsgBox = Sorry, you don't have permission to run this.

Else

DoCmd.SetWarnings False
If MsgBox("Once the numbers added into table, you can not undo." & vbCrLf & _
"Are you sure you want to do this?" _
, vbQuestion + vbYesNo, "Warning:") = vbYes Then
DoCmd.OpenQuery "appendtotblSerialno"
MsgBox "Finished"
End if
End sub

Please help?
Thank you in advance
 
You are trying to do two different things here so the IF... ELSE statement isn't logical.

Regarding the error, I would imagine it's a Form error so you should be able to catch the error number in the form's ON ERROR event. The following link should give you some ideas:

http://www.blueclaw-db.com/access_event_programming/errorevent.htm

As for the other code, put it in the form's Before Update event and change OpenQuery to RunSQL.
 

Users who are viewing this thread

Back
Top Bottom