D
deb
I have a form that enters schedule images.
If user tries to enter a duplicate, I would like to display a warning msg
and give options to proceed.
How should this be written?
if error 3022- The changes you requested to the table were not successful
because they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the index, or redefine the index.
Then...
Msg = "Warning Schedule Image for selected Report Date and Page was
previously entered." _
& vbCr & vbCr & "Yes, to be directed to the original record." _
& vbCr & "No, to delete current record." _
& vbCr & "Cancel, to make changes to current record."
ans = MsgBox(Msg, vbYesNoCancel)
If ans = vbNo Then
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
MsgBox "Duplicate Deleted."
Exit Sub
ElseIf ans = vbYes Then
Me.Undo
'Go to record of original ID
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
Exit Sub
End If
Thanks in advance,
If user tries to enter a duplicate, I would like to display a warning msg
and give options to proceed.
How should this be written?
if error 3022- The changes you requested to the table were not successful
because they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the index, or redefine the index.
Then...
Msg = "Warning Schedule Image for selected Report Date and Page was
previously entered." _
& vbCr & vbCr & "Yes, to be directed to the original record." _
& vbCr & "No, to delete current record." _
& vbCr & "Cancel, to make changes to current record."
ans = MsgBox(Msg, vbYesNoCancel)
If ans = vbNo Then
Me.Undo
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
DoCmd.GoToRecord , , acNewRec
MsgBox "Duplicate Deleted."
Exit Sub
ElseIf ans = vbYes Then
Me.Undo
'Go to record of original ID
rsc.FindFirst stLinkCriteria
Me.Bookmark = rsc.Bookmark
Exit Sub
End If
Thanks in advance,