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

Can a report have a variable number of columns?!? 1

Status
Not open for further replies.

DCBBB

IS-IT--Management
Aug 22, 2001
33
US
I have a very complex report which calls for a variable number of columns. For example, let's say I need supervisors down the left as rows and their subordinates acrosss the top as columns. For data I might have hours worked this week and hours worked last week and a couple of calculations. I would like a separate report for each supervisor so can envision setting up a loop (which I can figure out). BUT, since each supervisor has a different number of subordinates, how do make the number of columns automatically grow and shrink accordingly (so no blank columns show). Is this even possible? (I know this isn't the ideal structure for a report like this, but this is how my audience wants to see it!) Thanks!
D
 
Even w/ the crosstab query as the ssource, you will need to do some unusual code to get the results you want. It IS possible to add/delete controls to a report at run time, but it isn't pretty. An alternative would be to sett he vidible property of 'un-used' controls to FALSE. I THINK this is fairly straight forward, if tedious.

With the crosstab, you will return some number of columns (say subordinates) and some number of rows (Supervisors?). You should be able to retrieve the col count, which would be RELATED to the number of employees, so (for example) you have three columns of info for each "sub" plus the Boss, four subs would return 13 cols. In which instance you simply hide any 'col' after #13.

Actually, with some amount of detail fiddling, make the report page break on the "sup" (nee "BOSS") name and just do the one report. make the necessary changes to the # cols visible in the group header code.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top