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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Building a Report from Visual Basic

Status
Not open for further replies.

paxelius

Programmer
Jan 21, 2004
22
NO
In my database I only have one table.
My report needs to print some of the fields.

I used to make a query that selected those fields and made that query the controlsource of my report, thus adding the fields to the report page, listing every occurence of the fields in my table --- even those that are blank, with no data.

I need to make a report that ignores the blank fields, only the fields that have data should be printed to the report.. Or rather (a little more complicated) I have a set of fields that I need to check for data, if all of them are blank except one, I still need to print them all. Only if they are all empty, none should be printed.

Is there a way to feed my fieldvalues into some unbound textboxes or labels in the report-page that makes this simple.. or do I have to Print them to the report-page ?

I need to save the report to .xls aswell, that's why merely printing the values to the report is a bad idea I think, because the empty fields will still be present in the .xls document.

-Aeron Pax
 
The only idea I have is to check each field using a query like this:

SELECT Count(TheFieldName) As NotNullCount FROM TheTableName WHERE TheFieldName Is Not Null.

If NotNullCount is greater than zero, then include that field in the query that will become the recordsource for your report.
 
Thank you mndrlion! I will try your method..

-Aeron Pax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top