请教一下高手,我想第一段代码用来查询姓名的代码,能实现第二段用来查姓名的功能,那第一段代码怎么修改呢?第一段代码是帮助那里教的,搜索姓名的时候一定要输入全名,但是第二段代码就不用,只要输入一个姓就可以查询到同姓氏的所有人。麻烦高手帮忙修改一下,谢谢!
在按钮事件的click:
Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "分队 = '" & .Value & "'"
End If
End With
With e.Form.Controls("TextBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "姓名 = '" & .Value & "'"
End If
End With
If Filter > "" Then
Tables("基本信息").Filter = Filter
End If
在textbox1事件的TextChanged:
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("基本信息")
If txt = "" Then
tbl.Filter = ""
Else
txt = "'*" & txt & "*'"
tbl.Filter = "姓名 Like " & txt
End If