zaphod2003
09-10-2007, 06:56 AM
I have an access form which is linked to an access table and has a save button which when clicked attempts to save the data back to the table using the access standard save code:
Private Sub btnSaveRecord_Click()
On Error GoTo err_btnSaverecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
exit_btnSaveRecord_Click:
Exit Sub
err_btnSaverecord_Click:
MsgBox Err.description
Resume exit_btnSaveRecord_Click
End Sub
In itself this works fine except that if a record is duplicated it comes up with a message "The changes you requested to the table were not successful....... " etc etc
This message is too wordy and I want to change it to something else by interrupting this error. However, I only want to appear if and only if the user is trying to duplicate a record and not simply make updates to an existing record.
Any suggestions how I could modify the above method to do this?
Private Sub btnSaveRecord_Click()
On Error GoTo err_btnSaverecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
exit_btnSaveRecord_Click:
Exit Sub
err_btnSaverecord_Click:
MsgBox Err.description
Resume exit_btnSaveRecord_Click
End Sub
In itself this works fine except that if a record is duplicated it comes up with a message "The changes you requested to the table were not successful....... " etc etc
This message is too wordy and I want to change it to something else by interrupting this error. However, I only want to appear if and only if the user is trying to duplicate a record and not simply make updates to an existing record.
Any suggestions how I could modify the above method to do this?