我创建了一个带有依赖多选列表框的组合框。我也有一个按钮,我想点击一个事件。 我希望这个事件能够在另一个表单中显示用户所做的选择(组合框和列表框上的多选项),以创建一个包含更多字段和更多信息的小表。
这是我到目前为止的代码,并且给了我一个" 3265"错误。 有什么想法吗?
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
由于