访问搜索功能:如果没有找到记录,则显示“No Match”
问题描述:
我在我的Access窗体中实现了搜索功能。用户可以搜索以查看是否存在现有条目。我想这样做,以便如果用户搜索并且没有现有条目,将会显示“找不到匹配”。访问搜索功能:如果没有找到记录,则显示“No Match”
下面是我的VBA代码至今:
Private Sub Command49_Click()
Dim strsearch As String
Dim strtext As String
strtext = Me.txtSearch.Value
strsearch = "SELECT * from ID_Theft_Log where (ID like strtext)"
Me.RecordSource = strsearch
End Sub
什么我需要添加到我的代码来显示文本?
答
IF strsearch.value = VbNullString Then
MsgBox "Not Found"
End if
如果dcount ..... = 0,则可以使用,然后不打扰SQL设置,或查看从它返回的记录。 –