Solved

Dynamically position and resize textboxes horizontally in reports using Access 2003

Posted on 2009-07-14
4
478 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
  • 2
4 Comments
 
LVL 77

Accepted Solution

by:
peter57r earned 100 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 150 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 150 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Access query expression 6 20
Reference Controls on subforms 7 28
Why get error when delete all records on a sub-form 2 15
Switch 5 15
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

776 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