参考代码:(如果不是单独查询按钮,代码写到ValueChanged事件)
Dim Filter As String
With e.Form.Controls("天数")
If .Value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter &= "天数 = '" & .Value & "'"
End If
End With
With e.Form.Controls("面试室")
If .Value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "面试室 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("首字母")
If .Value <> Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "首字母 like '%" & .Value & "%'"
End If
End With
If Filter > "" Then
Tables("号对人_号对人").Filter = Filter
End If
[此贴子已经被作者于2024/4/22 9:16:33编辑过]