BillyO
November 10th, 1999, 11:28 AM
I have a form that I need to add the ability to search for mult parameters in a query by the end user. I am having trouble with running an SQL query from my app with the LIKE operator
For instance:
Query from three text boxes; txtFirm , txtFirstName, txtLastName
Access database table called KDetail Using ADO control w/ Access 2000
---------------
Private Sub cmdSearch_Click
Dim aSQL as string '
Dim A, B, C as String
A= txtFirm
B= txtFirstName
C= txtLastName
aSQL = "SELECT * FROM KDetail WHERE Firm Like '"&(A)&"' AND FirstName Like" & _
" '"&(B)"' AND LastName Like '"&(C)"'"
If adoKDetail.Recordset.RecordCount = 0 Then
msgbox("No Record Found")
End If
End Sub
-----------------
When the code runs it doesn't allow for partial information ie Stev* for Steve
I only get the msgbox "No Record Found"
Bill
For instance:
Query from three text boxes; txtFirm , txtFirstName, txtLastName
Access database table called KDetail Using ADO control w/ Access 2000
---------------
Private Sub cmdSearch_Click
Dim aSQL as string '
Dim A, B, C as String
A= txtFirm
B= txtFirstName
C= txtLastName
aSQL = "SELECT * FROM KDetail WHERE Firm Like '"&(A)&"' AND FirstName Like" & _
" '"&(B)"' AND LastName Like '"&(C)"'"
If adoKDetail.Recordset.RecordCount = 0 Then
msgbox("No Record Found")
End If
End Sub
-----------------
When the code runs it doesn't allow for partial information ie Stev* for Steve
I only get the msgbox "No Record Found"
Bill