A
Allen
Hey all, I'm having a problem with this code. It is in Access 2003. It is a
find button to find a record by an input box for the ssn of a contact. I
keep getting a syntax error for the expression. Here is the code.
Thanks
Allen
Dim db As Database
Dim rs As DAO.Recordset
Dim sSQL As String
Dim sName As String
sName = InputBox("Enter the SSN of the person to find.", "Search for
name", "")
Set db = CurrentDb
Set rs = Me.RecordsetClone
sSQL = "SELECT Contacts.*, Contacts.SSN FROM Contacts WHERE
(((Contacts.SSN)=sName ));"
rs.FindFirst sSQL 'This is where the debugger stops at
If rs.NoMatch Then
'The name was NOT found
Else
'The name was found
End If
rs.Close
Set rs = Nothing
Set db = Nothing
find button to find a record by an input box for the ssn of a contact. I
keep getting a syntax error for the expression. Here is the code.
Thanks
Allen
Dim db As Database
Dim rs As DAO.Recordset
Dim sSQL As String
Dim sName As String
sName = InputBox("Enter the SSN of the person to find.", "Search for
name", "")
Set db = CurrentDb
Set rs = Me.RecordsetClone
sSQL = "SELECT Contacts.*, Contacts.SSN FROM Contacts WHERE
(((Contacts.SSN)=sName ));"
rs.FindFirst sSQL 'This is where the debugger stops at
If rs.NoMatch Then
'The name was NOT found
Else
'The name was found
End If
rs.Close
Set rs = Nothing
Set db = Nothing