I currently use this code to open a query based on listbox criteria.
currently I am opening this query with a new temp query "zzTempTable", is there anyway I can use this code to just open my zz table with the appropriate listbox criteria?
Code:
Dim ctl As Control
Dim varItm As Variant
Dim stItem As String
Dim strString As String
Dim qdfTemp As QueryDef
Set ctl = Me!lstT
For i = 0 To lstT.ListCount - 1
If lstTrains.Selected(i) Then
If lstT.Column(0, i) = "All" Then
flgSelectAll = True
End If
strIN = strIN & "'" & lstT.Column(0, i) & "',"
End If
Next i
Set qdfTemp = CurrentDb.CreateQueryDef("zzTempTable", "SELECT * FROM zz WHERE TT in (" & strIN & ");")
DoCmd.OpenQuery "zzTempTable"
DoCmd.OpenQuery "zz2final"
'Or alternatively output a report that references the query
'Delete query and free memory
CurrentDb.QueryDefs.Delete "qryTestQuery"
Set qdfTemp = Nothing
currently I am opening this query with a new temp query "zzTempTable", is there anyway I can use this code to just open my zz table with the appropriate listbox criteria?