--
老师 我这个查询按钮该怎么写
Tables("主窗体_计算机查询表").Filter = "[姓名] Like \'%王%\'"
Dim Filter As String
With e.Form.Controls("计算机部门")
If .Value IsNot Nothing Then
Filter = "部门 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("IP地址")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "IP地址 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("姓名")
If .Value IsNot Nothing Then
Filter = "姓名 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("外网")
If .Value IsNot Nothing Then
Filter = "外网 = \'" & .Value & "\'"
End If
End With
Tables("主窗体_计算机查询表").Filter = Filter
If Tables("主窗体_计算机查询表").rows.count = 0 Then
MessageBox.Show("未找到该数据")
End If