输入,号后,用SPLIT分隔出来
Private Sub cboRegion_AfterUpdate()
Dim strWhere As String
Dim vArr As Variant
Dim i As Integer
Dim Str As String
strWhere = ""
If Not IsNull(Me.cboRegion) Then
If Me.cboRegion = "All" Then
Me.txtRegion = "Export,Local"
vArr = Split(Me.txtRegion, ",")
For i = LBound(vArr) To UBound(vArr)
If vArr(i) <> "" Then
Str = Str & "'" & vArr(i) & "',"
End If
Next i
strWhere = strWhere & "[Region] in (" & Str & ") AND "
Else
strWhere = strWhere & "([Region] like '*" & Me.cboRegion & "*') AND "
End If
End If
If Len(strWhere) > 0 Then
strWhere = Left(strWhere, Len(strWhere) - 5)
End If
Me.Form.Filter = strWhere
Me.Form.FilterOn = True
End Sub
[此贴子已经被作者于2006-7-20 10:13:33编辑过]
|