Dim Filter As String
With xm.Text
If xm.Text > "" Then
Filter = "姓名 = '" & xm.Text & "'"
messagebox.show(filter)
End If
End With
With zc.Text
If zc.Text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "技术职务 = '" & zc.Text & "'"
messagebox.show(filter)
End If
End With
With jb.Text
If jb.Text Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "级别 = '" & jb.Text & "'"
messagebox.show(filter)
End If
End With
With bm.Text
If bm.Text > "" Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "部门 = '" & bm.Text & "'"
messagebox.show(filter)
End If
End With
With xb.Text
If xb.Text >"" Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "性别 ='" & xb.Text & "'"
messagebox.show(filter)
End If
End With
With sf.Text
If sf.Text >"" Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "身份 ='" & sf.Text & "'"
messagebox.show(filter)
End If
End With
If Filter > "" Then
Tables("人事信息主表").Filter = Filter
messagebox.show(filter)
End If
这样你就清楚了