lifeson
03-20-2009, 02:07 AM
Hi folks
Not been on for a while :hi:
How do I use a wildcard value in an SQL
heres my SQL
Private Sub BuildList(cGroup As String, cType As String, active As Boolean)
Dim qry As String
Dim idx As Long, icon As Long
qry = "SELECT TblComponentDetail.ComponentID, TblComponentDetail.ComponentGroupID, " & _
"TblComponentDetail.ComponentTypeID, TblComponentDetail.ActiveToDate, " & _
"TblComponentDetail.Description, TblComponentDetail.ActiveFlag, TblComponentDetail.Make, " & _
"TblComponentDetail.Model " & _
"FROM TblComponentDetail " & _
"WHERE (((TblComponentDetail.ComponentGroupID)='" & cGroup & "') " & _
"AND ((TblComponentDetail.ComponentTypeID)='" & cType & "') " & _
"AND ((TblComponentDetail.ActiveToDate)>Now()) " & _
"AND ((TblComponentDetail.ActiveFlag)=True));"
If I dont know cType when I run the SQL what value should I use to represent cType when calling the routine e.g.
Call BuildList(cGroup, "*", True)
I have tried
like"*" but that comes up with a mismatch error
I have tried just * and _
but no joy.
Not been on for a while :hi:
How do I use a wildcard value in an SQL
heres my SQL
Private Sub BuildList(cGroup As String, cType As String, active As Boolean)
Dim qry As String
Dim idx As Long, icon As Long
qry = "SELECT TblComponentDetail.ComponentID, TblComponentDetail.ComponentGroupID, " & _
"TblComponentDetail.ComponentTypeID, TblComponentDetail.ActiveToDate, " & _
"TblComponentDetail.Description, TblComponentDetail.ActiveFlag, TblComponentDetail.Make, " & _
"TblComponentDetail.Model " & _
"FROM TblComponentDetail " & _
"WHERE (((TblComponentDetail.ComponentGroupID)='" & cGroup & "') " & _
"AND ((TblComponentDetail.ComponentTypeID)='" & cType & "') " & _
"AND ((TblComponentDetail.ActiveToDate)>Now()) " & _
"AND ((TblComponentDetail.ActiveFlag)=True));"
If I dont know cType when I run the SQL what value should I use to represent cType when calling the routine e.g.
Call BuildList(cGroup, "*", True)
I have tried
like"*" but that comes up with a mismatch error
I have tried just * and _
but no joy.