C
Claudette Hennessy
I have a form with txtFirstName and txtLastName. The client has asked to be
notified if the input folk enter a first and last name which is already in
the database.
The procedure below is working as is, however after the entry in txtLastName
is undone, I would like to move to the txtFirstName control and undo that
also.
I have tried DoCmd.GoToControl "txtFirstName" and then Me!txtFirstNameUndo,
but get runtime error message 2018, " I must save the field. " How?
DoCmd.Save does not list an acfield.
Private Sub txtLastName_BeforeUpdate(Cancel As Integer)
If (Not IsNull(DLookup("[LastName]", "tblStaff", "[LastName] ='" _
& Me!txtLastName & "'" & " AND [FirstName] ='" & Me!txtFirstName &
"'"))) Then
MsgBox "This person has already been entered in the database."
Cancel = True
Me!txtLastName.Undo
End If
End Sub
Any help appreciated..
notified if the input folk enter a first and last name which is already in
the database.
The procedure below is working as is, however after the entry in txtLastName
is undone, I would like to move to the txtFirstName control and undo that
also.
I have tried DoCmd.GoToControl "txtFirstName" and then Me!txtFirstNameUndo,
but get runtime error message 2018, " I must save the field. " How?
DoCmd.Save does not list an acfield.
Private Sub txtLastName_BeforeUpdate(Cancel As Integer)
If (Not IsNull(DLookup("[LastName]", "tblStaff", "[LastName] ='" _
& Me!txtLastName & "'" & " AND [FirstName] ='" & Me!txtFirstName &
"'"))) Then
MsgBox "This person has already been entered in the database."
Cancel = True
Me!txtLastName.Undo
End If
End Sub
Any help appreciated..