message box if no filter results

I have a unbound search text box on a form that has a table record source.  I also have a button that will execute a filter with the following macro builder code:

[PLU] Like "*" & Forms![Item_Master]!SearchFeild & "*"

I want to display a message box if no filter results are found.  How can I do this?
Who is Participating?
Rey Obrero (Capricorn1)Commented:
place this codes before you apply the filter,
change "NameOfTable or Query" with the actual name of table or query

if dcount("*", "NameOfTable or Query", "[PLU] Like "*" & Forms![Item_Master]!SearchFeild & "*") =0 then
msgbox "No records to show"
exit sub
end if
tike55Author Commented:
If I select the bottom row (empty row that has an * in the first field) in the lower half of the split form, the form clears and the filter and messagebox functions correctly .  If any other record is selected on the bottom of the form a  message box pops up for everything.

 Is there any way to add some vba code that will select the bottom empty row and clear the form everytime someone hits the button to execute the filter?
tike55Author Commented:
Figured it out! go to new record
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.