The code needs a closing parenthesis after the vbYesNoCancel line... apologies for the typo. The entire code with your names should be:
Private Sub Form_BeforeUpdate(Cancel as Integer)
Dim iAns As Integer
Dim rs As DAO.Recordset
Dim vUserID As Variant' assuming you have a Long Int or Autonumber UserID
vUserID = DLookUp("UserID", "TblUSERLIST", "Name2 = """ & Me.txtName2 _
& """ AND Name1= """ & Me!txtName1 & """")
If IsNull(vUserID) Then ' not a match, all is well
Cancel = False
Else
iAns = MsgBox("A client of this name is already in the database." _
& vbCrLf & "Click YES if this is a different person," _
& vbCrLf & "Click No to go to the existing record," _
& vbCrLf & "Click Cancel to erase the form and start over:", vbYesNoCancel)
Select Case iAns
Case vbYes
Cancel = False ' let the addition proceed
Case vbNo
Cancel = True ' cancel the addition
Me.Undo ' erase the form
rs = Me.RecordsetClone
rs.FindFirst "[UserID] = " & vUserID
Me.Bookmark = rs.Bookmark
Case vbCancel
Cancel = True
Me.Undo ' just blank the form and quit
End Select
End If
End Sub
This assumes (since you didn't say) that the Table has fields named Name1 and Name2, and the Form has Controls (not fields, forms don't HAVE fields) named txtName1 and txtName2; and that tblUserList has a Primary Key field named UserID. If your table has
a different primary key use it in place of UserID; if it doesn't have a Primary Key... well, then you need to correct the erroneous structure of your database by adding one, and setting up appropriate relationships to other tables.