Solved

Needed  fast: How-to create a dynamic report?

Posted on 1998-05-25
5
367 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
1 inch = 1440 twips -- it is a microsoft measurement
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

744 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

17 Experts available now in Live!

Get 1:1 Help Now