-
When using a text field with a where statement I get "Invalid Column name" WHY?
SQL = "SELECT * FROM Employees where LastName = KING"
rs.Open SQL, dcnNWind, adOpenForwardOnly, adLockReadOnly
Using a number field everything is fine!
SQL = "SELECT * FROM Employees where Employee_ID = 7"
rs.Open SQL, dcnNWind, adOpenForwardOnly, adLockReadOnly
Thanx
-
Using this works
strTest = "King"
SQL = "SELECT * FROM Employees where LastName ='" & strTest & " '"
rs.Open SQL, dcnNWind, adOpenForwardOnly, adLockReadOnly
-
you weren't putting single quotes around your criteria:
this
SQL = "SELECT * FROM Employees where LastName = KING"
should have been this
SQL = "SELECT * FROM Employees where LastName = 'KING'"
You properly did that in your second reply, but you might want to lose the space at the end
...'" & strTest & " '"
should be
...'" & strTest & "'"