Select Record Statement #2

Mechele

Registered User.
Local time
Today, 22:45
Joined
Jan 25, 2002
Messages
121
StrSQL3 = "SELECT * FROM EnrollmentInformationTable " & _
"WHERE (((EnrollmentInformationTable.EmployeeSSN) = " & Forms!UpdateForm!temp & ") " & _
"AND ((EnrollmentInformationTable.EmployeeLastName) = """ & Forms!UpdateForm!EmployeeName & """));"

I'm getting the error message: "Data type mismatch in criteria expression."
Can anyone help me out? :confused:
 
Last edited:
Is SSN being captured as a text field or a number?

Also, you might want to check the number of """ you have on that second criteria statement.
Numbers do not require " quotes and strings or text can be denoted with '" &

StrSQL3 = "SELECT * FROM EnrollmentInformationTable " & _
"WHERE (((EnrollmentInformationTable.EmployeeSSN) = " & Forms!UpdateForm!temp & ") " & _
"AND ((EnrollmentInformationTable.EmployeeLastName) = '" & Forms!UpdateForm!EmployeeName & "'));"
 
...

for example:

firstname - text
age - number

the SQL is:
select * from MyTable where firstname='Mechele' and age=32

if the filed are text than u need to put ' between and after

goodluck!
 
There was a typo -

This works and has been TESTED...

Code:
StrSQL = "SELECT * FROM EnrollmentInformationTable " & _
    "WHERE EnrollmentInformationTable.EmployeeSSN = " & Chr(34) & Me.SSN & Chr(34) & _
    " AND EnrollmentInformationTable.EmployeeLastName = " & Chr(34) & Me.EmployeeName & Chr(34)
 
what is char(34). I assumed it was (" apostrophe) in your last response...
 
I just emailed the DB back to ya - chr(34) is a double quote - the same as """ I just like to use chr(34)

Jerry
 

Users who are viewing this thread

Back
Top Bottom