Solved

Needed  fast: How-to create a dynamic report?

Posted on 1998-05-25
5
380 Views
Last Modified: 2008-02-01
Hello,

i'm rather new to MS Access and have a possibly easy to answer, but for me urgent question:

How do i create a report that will display its results based on a table with varying column-count?

Follow me? I have a table (result of a query) with 3 to 72 columns. I want to print the results that appear here. How do i create a dynamic report that will use this table as it's source?

Please help me out, Answers.mdb doesn't go this deep...

Regardz,

Joachyz!
0
Comment
Question by:joachyz
5 Comments
 
LVL 8

Expert Comment

by:Helicopter
ID: 1974352
How do you want to display the columns? 72 columns across a page would be impractical so I guess they would be listed down the page. Incidentally you do mean columns and not rows don't you?

If your table has 72 fields then presumably your query puts something into them in which case you just need one text box for each field, bind the report to the query and bind each text box to the required field. This will mean that any empty fields will be blank on the page but unless you want to dynamically place the text boxes there's no way round that.

If you do mean 3 to 72 rows then all you need is one text box bound to that field then in the on format event check if it is empty and if so set cancel=true so that blanks won't be printed.


0
 

Author Comment

by:joachyz
ID: 1974353
Thanks for your prompt response, however:

- I *do* mean 72 columns.
- I create a table dynamically, it can contain 3 to 72 columns, depending on what a user selects. (This requires some cool coding, it's all SQL :-)
- This table needs to be displayed in a formatted way. I consider to create x reports, and display them if needed or something.
- On one page 3 columns can be displayed, so that can take a lot of paper...

Help me!

Regardz,

Joachyz!
0
 
LVL 1

Accepted Solution

by:
Arve earned 200 total points
ID: 1974354
First, you design the report with 72 columns, like it would be when you have to use all columns. All fields is named like lbl01 to lbl72, txt01 to txt72. Find also out the space between every field. Then set visible=false and left = 0 on all fields.
On report.open event, find out how many columns you have and do this:
for i = 1 to me.recordsource.count
  me("lbl" & format$(i,"00")).left = i * 2000
  me("lbl" & format$(i,"00")).Visible = true
  me("txt" & format$(i,"00")).left = i * 2000
  me("txt" & format$(i,"00")).visible = true
next i
'2000 is the distance in twips between the fields, you need to 'use another value.

'This is not tested code

Regards, Arve
0
 

Author Comment

by:joachyz
ID: 1974355
I give you excellent grading :-) for the quick reponse. Actually i would like to test it first, but that will not be possible, only l8ter at home. Please allow me to ask you more questions when i try it out...

By the way, what are 'twips' ???

Well, anyway, thanks!

0
 
LVL 3

Expert Comment

by:strykker
ID: 3731052
1 inch = 1440 twips -- it is a microsoft measurement
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now