adams.bria
Registered User.
- Local time
- Today, 09:05
- Joined
- Apr 28, 2010
- Messages
- 41
So I have a search function that work great. However, now if my search returns no results, I would like to have a pop-up that tells the user no results were found. (Ideally I would like to from the pop-up to ask them if they want to enter the user, but I don't think that is possible) Here is my code, anyone have any ideas on where to stick an if no results logic?
Thanks in advance.
Thanks in advance.
Code:
Private Sub cmdGo_Click()
On Error GoTo cmdGo_Click_Err
If (Eval("[Forms]![frmClient_Center]![searchbox] Is Null")) Then
' Clear Filter when search box empty
DoCmd.RunCommand acCmdRemoveFilterSort
DoCmd.SetProperty "cmdShowAll", acPropertyEnabled, "0"
End
End If
' Handle "'s in search
TempVars.Add "strSearch", Replace(Forms!frmClient_Center!searchbox, """", """""")
' Build the Filter
TempVars.Add "strFilter", "([client_ID] Like "" * " & [TempVars]![strSearch] & " * "" )"
TempVars.Add "strFilter", TempVars!strFilter & " OR ([ssn] Like "" * " & [TempVars]![strSearch] & " * "" )"
DoCmd.ApplyFilter "", TempVars!strFilter, ""
TempVars.Remove "strFilter"
TempVars.Remove "strSearch"
DoCmd.SetProperty "cmdShowAll", acPropertyEnabled, "1"
cmdGo_Click_Exit:
Exit Sub
cmdGo_Click_Err:
MsgBox Error$
Resume cmdGo_Click_Exit
End Sub