R
RipperT
If user enters an InmateId value and a ClassDate (a unique index) that
already exits in the table, I want to undo what the user punched in and go
find the record they tried to duplicate. A button click is called that fires
two SendKeys "{ESC}", which undoes everything on the form, but I still get a
runtime error at Me.Bookmark = rs.Bookmark: "The macro or function set to
the BeforeUpdate or ValidationRule property for this field is preventing db1
from saving the data in the field." Why is it trying to save anything? I've
undone all the fields, like it's a new record. Shouldn't it now go to the
record specified in rs.FindFirst "InmateId = '" & strInmateID & "'"? How can
I get it to do this? Many thanks, Ripper
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim strInmateID As String
Const conErrDuplicateKey = 3022
Select Case DataErr
Case conErrDuplicateKey
MsgBox "This record already exists. ", vbExclamation, "Data Error"
strInmateID = Me.InmateID
btnUndo_Click
Response = acDataErrContinue
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "InmateId = '" & strInmateID & "'"
If rs.NoMatch Then
MsgBox "No entry found.", vbInformation, "Data Not Found"
ElseIf Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
End Select
End Sub
already exits in the table, I want to undo what the user punched in and go
find the record they tried to duplicate. A button click is called that fires
two SendKeys "{ESC}", which undoes everything on the form, but I still get a
runtime error at Me.Bookmark = rs.Bookmark: "The macro or function set to
the BeforeUpdate or ValidationRule property for this field is preventing db1
from saving the data in the field." Why is it trying to save anything? I've
undone all the fields, like it's a new record. Shouldn't it now go to the
record specified in rs.FindFirst "InmateId = '" & strInmateID & "'"? How can
I get it to do this? Many thanks, Ripper
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim strInmateID As String
Const conErrDuplicateKey = 3022
Select Case DataErr
Case conErrDuplicateKey
MsgBox "This record already exists. ", vbExclamation, "Data Error"
strInmateID = Me.InmateID
btnUndo_Click
Response = acDataErrContinue
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "InmateId = '" & strInmateID & "'"
If rs.NoMatch Then
MsgBox "No entry found.", vbInformation, "Data Not Found"
ElseIf Not rs.EOF Then
Me.Bookmark = rs.Bookmark
End If
End Select
End Sub