Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check to see if object has data

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
0
0
US
I would like to check from within a Function if a Report has data but not sure how to go about it.

My Function needs test to see if the specified report(s) had any data and if not would then be ignored.

I assume this is going to require using the Object syntax and I don't know where to start.

Any indications welcomed

Happiness is...not getting what you want but wanting what you have already got
 
Binnit

If you are to cancel the printing/viewing the report when it has no data, then there is such a property for reports where you could fire any code you like
 
JerryKlmns

I appreciate the NoData event exists but I would like to check rather than actually call the report itself.

The reason is that I have a Parent report with 3 or more nested sub reports, if none of the sub reports have any data then I don't want the Parent report to open.

I cannot set the Parent report NoData event as this is an unbound report.

Am I making sense?


Happiness is...not getting what you want but wanting what you have already got
 
Copy that Binnit.

Use a recordset to see if there is at least one record for each report. The source property of the recordset should be

SELECT TOP 1 field1
FROM "The same FROM clause of the report"
WHERE "The same WHERE clause of the report"


and when opened check the .EOF & .BOF If both true then there exists no records at all.
 
JerryKlmns

Glad someone understands me....thanks for your post, will give it a try and post back result next week probably.

Thanks again

Happiness is...not getting what you want but wanting what you have already got
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top