Records Not Found

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,

One of the frustrating things about self-teaching oneself is finding answers
to what I know are simple solutions.

So here is my dilemma, I have a query that when it doesn't find any records
simply shows an empty table. What I would like it to do is to return a
Message Box with "No Records Found" and return it to the original starting
point. I know how to write a message box, etc., but what I can seem to find
is code or property in regards to a"No records found" scenario.

One problem is that my VB here at work did not have the HELP installed
corretcly, if at all, with the disk buried somewhere. With my texts, I cant
seem to find the proper keywords in the index.

Any help would be appreciated.

Cordailly,
Brad
 
You can use Dcount

If DCount("*","QueryName") = 0 Then
MsgBox "No records found"
Else
......
End If
 
This depends on how you open the datasheet view of the Query. If you open
the query through the Queries tab of the Database Containers window, you
can't not use code to show a MsgBox. If you use code to open the open the
datasheet view of the Query, you can use DCout as per Ofer's advice.

OTOH, for a properly-deployed database application, users should not
normally view data through datasheet view of the Query. The proper GUI for
the users to view / edit / add data is Forms where you can control and
response to the users' actions using Form Events and VBA code.
 
Van,

Thanks for both of the replies. As you mentioned, I do have my query linked
through a form. In trying to simplify my question, I omitted that aspect,
but thanks for the clarification.

Brad
 
You're welcome...

That's the hard part in responding to posts: you never know for sure what is
the set-up and which aspects you should direct your responses to.
 
Back
Top