print report when it contains no records

  • Thread starter Thread starter mike_dowler
  • Start date Start date
M

mike_dowler

Guest
Hi guys! I need some help please... Working in A2K using VBA.

I have searched the forum and found lots of posts on using Nodata - but I am trying to do something different. When a report (based on a query) is empty (no records) I DO want the report to print, ideally with a single text box to the effect that there were no records. I need that positive confirmation that the report is empty.

I have tried putting a text box in there with Visible = False, which I could then change using DCount or something to Visible = True if there are no records... But: I can't put it in the detail (cos there isn't one if there are no records) and the header won't canshrink, so there is a big empty space there the rest of the time.

Any thoughts?

Mike
 
Not sure if this will work but try something like this:

put a text box in the detail section called txtCount, set the control source to =1 then set the running sum property to over group.

Then you could write an if statement:
This goes in the on format event of the detail section.

If txtCount.text < 1 then
txtNoRecords.Visible = True
If txtCount.text > 1 then
txtNoRecords.Visible = False
End If

if the txtCount.test < 1 might want to try is null or = ""
 
Sorry - my mistake

For some reason, I had it in my head that the detail section didn't show at all if there are no records. I have had a quick play though, and apparently they do. so you can do what I wanted - just put something in the "nodata" event that makes the box visible. sorted! sorry for wasting anyone's time...
Mike
 

Users who are viewing this thread

Back
Top Bottom