FLL
Aug 24th, 2000, 08:07 PM
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
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