又是我。This code works fine when only 1 item is selected, however when more than one item is selected I get the error "syntax error (comma) in query expression" on the following line of code: intCountNull = DCount("*", "Scrubbed ", strCriteria & " 为空")
这是我的代码:
Private Sub Command29_Click()
Dim strCriteria As String
Dim intCountNull As Integer
Dim varItem As Variant
'On Error GoTo Err_Command29_Click
Me.Fields_Values.RowSource = ""
For Each varItem In Me!List101.ItemsSelected
strCriteria = strCriteria & "," & Me!List101.ItemData(varItem)
Next varItem
strCriteria = Right(strCriteria, Len(strCriteria) - 1)
intCountNull = DCount("*", "Scrubbed", strCriteria & " Is Null")
Fields_Values.RowSource = intCountNull & " null values found in " & strCriteria
Exit_Command29_Click:
Exit Sub
'Err_Command29_Click:
'MsgBox "Please select a field"
结束子