Changing height of text boxes

M

Michael R

I am trying to make a form that displays lines to
separate fields both up and down and left to right.
Thus, I create the text boxes for the fields and give
them both a 1 pt border and make them variable in size.
However, since all of them can be different heights, the
lines on the bottom of these boxes don't line up. So, I
want to change the height of the each box to equal the
height of the section. Is there any way to write a
function that can do this in VB? I can retrieve the
height of the detail section, but I can't apply it to the
text box heights.
 
M

Michael R

Actually, it does apply the height in VB code, however,
it does so before the autosizing events that change the
text boxes to fit their data and the section to fit the
largest text box. What I would like to do is change all
the text boxes to the same size as the detail section
AFTER it has autosized everything, so that all the boxes
are the same height.
 
M

Marshall Barton

Michael said:
I am trying to make a form that displays lines to
separate fields both up and down and left to right.
Thus, I create the text boxes for the fields and give
them both a 1 pt border and make them variable in size.
However, since all of them can be different heights, the
lines on the bottom of these boxes don't line up. So, I
want to change the height of the each box to equal the
height of the section. Is there any way to write a
function that can do this in VB? I can retrieve the
height of the detail section, but I can't apply it to the
text box heights.

Kind of a catch 22, isn't it.

You have to use the report's Line method (in the section's
Print event) to draw the vertical lines. Since Access clips
anything you draw beyond the section's boundaries, you do
not have to be concerned with how tall the text boxes are,
just make the lines as tall as the page:

Me.Line (atextbox.Left, Me.Top) - Step(0, 20000)

Stephen Lebans' PrintLines code takes care of all the
details with this stuff. Check it out at:
www.lebans.com
 
T

Travis

I am having the same problem unfortunately and don't know
of a GOOD solution. There are three solutions I thought
of, although they aren't very good:
-Idea #1: Write a macro to open a report, close it and
open it again. Then write a VB module with appropriate
flags to gather the information, store it in an array, and
grab the maximum height per cord onFormat() the second
time the report is opened.
-Idea #2: Same ideas as above, only instead of an array,
draw lines around the detail section itself on every print
call. This unfortunately does nothing in terms of
maintenance/allowing flexibility in the report.
-Idea #3: This is definately the programmer one. Write a
cursor to find the greatest height of all the textbox of
the current record based on length of the field alone.
You should be able to approximate how many characters of a
certain sized font will fit in a text box of a cetain
width with fair accuracy (+/- 10). Make your height grow
accordingly.

Again, as I've mentioned, I don't like any of these
ideas. If you've come up with a solution (I know its been
nearly a month), please post.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top