Dim Filter As String
With e.Form.Controls("Txt料号")
If .Value IsNot Nothing Then
Filter = "物料编码 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("Txt名称")
If .Value IsNot Nothing Then
If filter> ""
Filter =Filter & "and 物料名称 like '%" & .Value & "%'"
Else
Filter ="物料名称 like '%" & .Value & "%'"
End If
End If
End With
With e.Form.Controls("Txt规格")
If .Value IsNot Nothing Then
If filter> ""
Filter =Filter & "and 物料规格 like '%" & .Value & "%'"
Else
Filter ="物料规格 like '%" & .Value & "%'"
End If
End If
End With
msgbox(filter)
If filter Is Nothing Then
Tables("库存总表_TabKC").ApplyFilter = False
ElseIf Filter > "" Then
Tables("库存总表_TabKC").Filter = Filter
End If
前面提示的查找条件没有问题,如果查找列中有我要找的内容。也不会出现错误提示。
但如果没有的话,就会出现错误提示了
错误提示如下。
未将对象引用设置到对象的实例。