funwithaccess
Registered User.
- Local time
- Today, 07:49
- Joined
- Sep 5, 2013
- Messages
- 80
Hi,
I am not sure where to start or go about creating message box that would display "No results found" if my queries return no results. My search of the forums hasn't been fruitful.
I have created one form that has a text box and a button that works as a search function to run through the tables and displays the applicable queries. Currently, if no results are returned nothing happens. Preferably I would like a message box to display stating that there were "No results found". I would assume that the code would be associated with the "Find" button. Here is the VBA code as it stands, again, I haven't even attempted to add code for a message box.
Private Sub Find_Click()
On Error GoTo Find_Click_Err
If DCount("Heading", "Service Desk Manual Query") > 0 Then
DoCmd.OpenQuery "Service Desk Manual Query", acViewNormal, acReadOnly
End If
If DCount("Alias", "SD Documentation Query") > 0 Then
DoCmd.OpenQuery "SD Documentation Query", acViewNormal, acReadOnly
End If
If DCount("AssetNumber", "Xerox Assets Query") > 0 Then
DoCmd.OpenQuery "Xerox Assets Query", acViewNormal, acReadOnly
End If
If DCount("[IP Address]", "Xerox IP Query") > 0 Then
DoCmd.OpenQuery "Xerox IP Query", acViewNormal, acReadOnly
End If
If DCount("SerialNumber", "Xerox Serial Query") > 0 Then
DoCmd.OpenQuery "Xerox Serial Query", acViewNormal, acReadOnly
End If
Find_Click_Exit:
Exit Sub
Find_Click_Err:
MsgBox Error$
Resume Find_Click_Exit
Thank you in advance!!!!!!!
I am not sure where to start or go about creating message box that would display "No results found" if my queries return no results. My search of the forums hasn't been fruitful.

I have created one form that has a text box and a button that works as a search function to run through the tables and displays the applicable queries. Currently, if no results are returned nothing happens. Preferably I would like a message box to display stating that there were "No results found". I would assume that the code would be associated with the "Find" button. Here is the VBA code as it stands, again, I haven't even attempted to add code for a message box.
Private Sub Find_Click()
On Error GoTo Find_Click_Err
If DCount("Heading", "Service Desk Manual Query") > 0 Then
DoCmd.OpenQuery "Service Desk Manual Query", acViewNormal, acReadOnly
End If
If DCount("Alias", "SD Documentation Query") > 0 Then
DoCmd.OpenQuery "SD Documentation Query", acViewNormal, acReadOnly
End If
If DCount("AssetNumber", "Xerox Assets Query") > 0 Then
DoCmd.OpenQuery "Xerox Assets Query", acViewNormal, acReadOnly
End If
If DCount("[IP Address]", "Xerox IP Query") > 0 Then
DoCmd.OpenQuery "Xerox IP Query", acViewNormal, acReadOnly
End If
If DCount("SerialNumber", "Xerox Serial Query") > 0 Then
DoCmd.OpenQuery "Xerox Serial Query", acViewNormal, acReadOnly
End If
Find_Click_Exit:
Exit Sub
Find_Click_Err:
MsgBox Error$
Resume Find_Click_Exit
Thank you in advance!!!!!!!