JimK31
asked on
Write Conflict - Error Handled?
Can a "Write Conflict" dialog box be trapped and handled out of view from the user?
Thanks
Jim
Thanks
Jim
Sure, here's an example of error handling :
Private Sub MyFunction
On Error GOTO Err_Handler
'Your code here
Done_Proc:
Exit Sub
Err_Handler:
If Err.number = 1234 Then 'Put the number of the error you wish to trap
'Do whatever
else
msgbox err.description
end if
resume Done_Proc
End Sub
Private Sub MyFunction
On Error GOTO Err_Handler
'Your code here
Done_Proc:
Exit Sub
Err_Handler:
If Err.number = 1234 Then 'Put the number of the error you wish to trap
'Do whatever
else
msgbox err.description
end if
resume Done_Proc
End Sub
ASKER
Thank you both for the quick reply.
I understand how to error. I can not seem to error trap the Write Conflict dialog box and can not seem to get a number for it. My question is specific to the Write Conflict. I'm not even sure it is an error message.
I understand how to error. I can not seem to error trap the Write Conflict dialog box and can not seem to get a number for it. My question is specific to the Write Conflict. I'm not even sure it is an error message.
Yes it is. Use the forms OnError event to handle the error.
JimD
: JimK31 ...
Again ... you can trap those errors in the Form Error event ... **Before** the dialog appears. Those errors occur in the Form Error event ... so, if you have code there, you can handle it the way you want.
mx
Again ... you can trap those errors in the Form Error event ... **Before** the dialog appears. Those errors occur in the Form Error event ... so, if you have code there, you can handle it the way you want.
mx
More specifically, you check the DataErr variable for the error that occured and you set the Response variable to the action that you want Access to perform (displaying or surpressing the normal dialog)
You do not use normal error handling as you would in other modules expect to trap error in the code that is handling the form error.
JimD
One error is 7878:
The data has been changed.@Another user edited this record and saved the changes before you "attempted to save your changes.@Re-edit the record.@1@@1"
mx
The data has been changed.@Another user edited this record and saved the changes before you "attempted to save your changes.@Re-edit the record.@1@@1"
mx
ASKER
DatabaseMX:
OK, I see what your saying. I tested and it is there. So what would the code be to tell the Write Conflict dialog to "Save Changes"?
Jim
OK, I see what your saying. I tested and it is there. So what would the code be to tell the Write Conflict dialog to "Save Changes"?
Jim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all for the help.
The trap for this by Database MX works very well. Thanks.
Unfortunately, it only serves to give the user a message and undo their changes. You can not save and override the Write Conflict. As would be suggested in the many other posts about write conflicts, you just have to change your design and stop the conflict.
Thanks again.
Jim
The trap for this by Database MX works very well. Thanks.
Unfortunately, it only serves to give the user a message and undo their changes. You can not save and override the Write Conflict. As would be suggested in the many other posts about write conflicts, you just have to change your design and stop the conflict.
Thanks again.
Jim
mx