假设姓名文本框为【txt_姓名】,
Dim sch As String
if not isnull(txt_部门) then sch = "[部门] Like '*" & txt_部门 & "*'"
if not isnull(txt_姓名) then sch = sch & iif(sch="",""," and ") & "[姓名] Like '*" & txt_姓名 & "*'"
Forms!F_员工工资2.Q_员工工资子窗体.Form.Filter = sch
Me.Q_员工工资子窗体.Form.FilterOn = True
祝你成功!