( Q )我想通过ListBox控件选定的项目查询作为参数,如何做到这一点?
******************** Code Start ************************
Dim frm As Form, ctl As Control
Dim varItem As Variant
Dim strSQL As String
Set frm = Form!frmMyForm
Set ctl = frm!lbMultiSelectListbox
strSQL = "Select * from Employees where [EmpID]="
For Each varItem In ctl.ItemsSelected
strSQL = strSQL & ctl.ItemData(varItem) & " or [EmpID]="
Next varItem
strSQL=left$(strSQL,len(strSQL)-12))