Null value returned from query

herby_one

Registered User.
Local time
Today, 10:43
Joined
Sep 30, 2004
Messages
22
Hi,
I have similar question to that posted by puthenveetil today.
I have a form based on a query which asks the user to enter a street name. I'd like to display a msg if there are no records matching that street.

I'm not sure how to do a count on my query as it uses DISTINCT. This is the SQL:
SELECT DISTINCT Empty_Houses.*
FROM Empty_Houses
WHERE (((Empty_Houses.Street) Like "*" & [Enter street name] & "*")) OR (((Empty_Houses.Building) Like "*" & [Enter street name] & "*"));



Also tried using this code from SJ McAbney in another thread but with no luck.

If DCount("[ID]", "qryYourQuery") = 0 Then
MsgBox "There is no data for the information you have entered.", vbInformation, "No Records Returned."
Exit Sub
Else
DoCmd.OpenQuery "qryYourQuery"
End If


Any suggestions would be appreciated.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom