?
Solved

Dynamically position and resize textboxes horizontally in reports using Access 2003

Posted on 2009-07-14
4
Medium Priority
?
484 Views
Last Modified: 2013-11-28
Hi, I have a report in Access 2003 with 8 columns of data.  All columns (textboxes) are in the detail section of the report.  

When open or print this report, I would like Access to adjust the position of each column (textbox) and resize its width horizontally, based on the longest value of each column, that way it will be displayed and printed nicely without having any values being cut off.  Will you please help?  Thanks!
0
Comment
Question by:mulia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 400 total points
ID: 24851595
Why can't you size them to the largest value as you design the report?
0
 

Author Comment

by:mulia
ID: 24851728
The base table for this report gets truncated and reloaded with new data each time the report gets printed out. I can get the largest value of each column, but how can I move the starting position of each textbox for each column?  Thanks for helping me out...
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 600 total points
ID: 24852366
Although I have seen code to "Dynamically resize" Texboxes/Comboboxes based on the number of characters, this code not:
1. For beginners
2. Perfect
Because of WYSIWYG fonts, the same amonut of characters do not always take up the same amount of "Space"
For example, this is 20 Characters:
iiiiiiiiiiiiiiiiiiii
So is this
WWWWWWWWWWWWWWWWWWWW

... as you can see the "W's" take up about 2/3 more space than the "i's"

In other words any "Real" code to do this would have to verify the character and the "Case" of the character in order to do this exactly.
(Most of the code to do this "Averages" the font by using "0" as a reference character.
(But you can see that this will not be perfect.)

This is just the "Size"
If this is not dependable, you can't hope to "Reposition" the texboxes.

Access does a fairly decent job of sizing the textboxes based on the  "FieldSize" property you set in the table.

JeffCoachman


0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 600 total points
ID: 24856555
So if your question is: Can the resizing on the textbox be done...
The answer is yes, provided you are willing to calculate the dimensions of *Every* character in *Every* possible font in both upper and lower case.
If your question is if the textboxes can be moved dynamically based on the size of the textbox, the answer is again, Yes, provide you are willing to do all the above calculations and then calculate the space between the textboxes then calculate the distance the textbox should be from each other based on the above calculation plus the distance between the textboxes.

In other words, anything is possible.
If it worth the trouble, is another story.

I have never seen anything like this done in any reporting engine.
I have never had the need to do this myself

Again, if you use the Report Wizard, Access does a pretty good job of sizing the textboxes based on the Fieldsize property you set in the table.
Access also spaces the textboxes apart at a consistent distance.

So if your question is: Is there an "Easy/Quick/Simple" way to do this (and is it worth the trouble), then IMHO, the answer is No.

JeffCoachman
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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 …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

719 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