Get the query to show records

  • Thread starter Thread starter Jacques Latoison
  • Start date Start date
J

Jacques Latoison

I have a query that has a criteria making it possible to not have any
records when the query runs. How do you make the query show records of
Zero's when there are no records existing.
I already tried Nz for the query, but that doesn' work.

Thanks beforehand,
 
Not sure what you mean. The query pulls up matching records. If none
match, none display.
 
Understood, but then the report shows errors.
I need the query to show records when none exist.
 
Well, you can't show records when none exist. You could build a test into
your report that displays or does something different if there are no
records found. Do a search and read through previous posts on the topic.
 
I normally search first, then post when I wasn't able to find any previous
posts to resolve the issue. Currently there aren't any posts that cover the
issue, unless I'm using the wrong words in my search.

What should I be looking for when searching?
 
Hi,


You may try to include the logic inside a VBA subroutine, checking if
there is records, or not, with a DCount, as example.

Nz operates on a NULL, which IS a value, as much as 0 is a value (that
may means there is no money left in your bank account, but that IS a value).
If you have no value at all, if you are not client of the bank, Nz won't do
anything good. Possible scenario:

0 : you have no money left
NULL : the system is down, we cannot know how many money
is left
-no data- : there is no system to interact with in the first
place.


So, in VBA, you can use something like:

If 0=DCount("*", "tableName", criteriaHereAsString ) then
MsgBox "sorry boss, no record"
Else
... do whatever has to be done if there are records
End If



Hoping it may help,
Vanderghast, Access MVP
 
Please refer to my new post with a subject of "Producing records from
nothing".
That may explain it better.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top