Dim Filter As String = "1=1"
With e.Form.Controls("托运")
If .Value IsNot Nothing Then
Filter &= " and 托运单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("回单")
If .Value IsNot Nothing Then
Filter = Filter & " and 回单 = '" & .Value & "'"
Else
Filter = Filter & " and (回单 is Null Or 回单 = '')"
End If
End With
If Filter > "" Then
Tables("应付应收录入").Filter = Filter
End If