-
I've got a question concerning querying an Access DB. When I run the following code, it works fine:
Dim strSQL As String
strSQL = "SELECT * FROM Customers WHERE "
'Code to handle empty text box
strSQL = strSQL & "UniqueID = " & txtUnique.Text
That works. However, when I set the string to search a text value (where the ID is a numeric value):
strSQL = strSQL & "LastName = " & txtLast.Text
I get a data type mismatch. It puts the debugging program to the connection string that uses strSQL as the adCmdText.
Any ideas? Is it something I am not doing with quotation marks?
Thank you.
FLL
-
Hi FLL
Yes you do need quotation marks for strings try replacing you code with
strSQL = strSQL & "LastName = '" & txtLast.Text & "'"
That should sort out your problem
Hope it helps
Ian
-
Thanks, Lan. I am now searching on string values.
I appreciate the guidance.
FLL