Reputation: 11
I have create a combobox with a depending multiselection List box. I also have a button, which I want to assign an event on click. I want this event to be able to show the selections the user did (combobox and multi selections on List box) in another Form to make a little table with more fields and more info.
This is the code I have so far, and throws me an "3265" error. Any ideas?
Private Sub Command129_Click()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
Set db = CurrentDb()
Set qdf = db.QueryDefs("tblConfig Query")
For Each varItem In Me!List126.ItemsSelected
strCriteria = strCriteria & ",'" & Me!List126.ItemData(varItem) & "'"
Next varItem
If Len(strCriteria) = 0 Then
MsgBox "You did not select anything from the list" _
, vbExclamation, "Nothing to find!"
Exit Sub
End If
strCriteria = Right(strCriteria, Len(strCriteria) - 1)
strSQL = "SELECT * FROM tblConfig " & _
"WHERE tblConfig.TypeConfig IN(" & strCriteria & ");"
qdf.SQL = strSQL
DoCmd.OpenQuery "tblConfig Query"
Set db = Nothing
Set qdf = Nothing
End Sub
Thanks
Upvotes: 0
Views: 59