Solved

Dynamically position and resize textboxes horizontally in reports using Access 2003

Posted on 2009-07-14
4
475 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

743 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

11 Experts available now in Live!

Get 1:1 Help Now