Access 2000 - Bound Form - Optimistic Locking

G

Guest

With Access 2000, I am using a bound from with Optimistic locking (ie .Recordlocks = No Locks), and Row Level Locking set to true. On the Form I have a command button to save the record like so:

Sub CmdSave_Click
On Error GoTo Error_cmdSave

DoCmd.RunCommand acCmdSaveRecord
Exit_cmdSave:
exit sub
Error_cmdSave:
MsgBox "Error " & err.number & " " & err.description
resume exit_cmdSave
End Sub

When two users edit same record, I get a standard Access/Jet message giving three options (Save and overwrite other users changes, discard changes, save changes to clipboard), No Error is generated to be trapped by On Error GoTo.

how can I override this message with my own custom message and reduce the options available to the user to simply discard their changes.
 
A

Allen Browne

Since this is an engine-level error, use the Error event of the Form to trap
it.

Test for DataErr = 7787, and set the Response.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

KenReay said:
With Access 2000, I am using a bound from with Optimistic locking (ie
..Recordlocks = No Locks), and Row Level Locking set to true. On the Form I
have a command button to save the record like so:
Sub CmdSave_Click
On Error GoTo Error_cmdSave

DoCmd.RunCommand acCmdSaveRecord
Exit_cmdSave:
exit sub
Error_cmdSave:
MsgBox "Error " & err.number & " " & err.description
resume exit_cmdSave
End Sub

When two users edit same record, I get a standard Access/Jet message
giving three options (Save and overwrite other users changes, discard
changes, save changes to clipboard), No Error is generated to be trapped by
On Error GoTo.
how can I override this message with my own custom message and reduce the
options available to the user to simply discard their changes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top