Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP ... Aligning Text Box Borders 1

Status
Not open for further replies.

JRA

Programmer
Apr 19, 2001
106
CA
Hello,

I really need some help with my VBA code on my Access database. What I am try to do is set-up my report so that all columns that I have bordered with a black boder will align up to the longer border.

Let me explain in more detail. I have a report that has four tect boxes on it. Each text box is bordered with a black line that is part of the input box property. My first text box is just a auto-number, my second and third text box is set to a text property and my third text box is set-up to hold memo capabitities. Anyways, when the report is printed, the first text box border is really short, the second and third are a bit longer and the third is the longest. What I want though is that all four text boxes are the same length when I print the report, lining up with the longest text box, rather than each box being a seperate length.

It has been suggested to me that if I put some code on the 'On Format' event with the Detail section, I might be able to correct this problem. I have no idea how to do this though. I would really appreciate any help because I have to have this sorted out very soon.

Thanks in adavnce,
James.
 
Why not try having no text boxes, but put fixed boxes of the required size on the report. Place the text fields on the report in front of a box and I think that may give you the look you require.
 
Dennis,

I know, I know, I know ... LOL LOL. I said the exact same thing, BUT my supervisor is insistant that it must be done this way because the size will vary for each report..

Do you have any idea how?

Thanks,
James.
 
Try this in the Detail On Format

Set the height of the shorter fields to the field that should be longest. This works if a particular field will always be the longest.

Or compare the fields.Height and organize the code to set the others to the .height of the longest.

Example Code:

Me![Claim Amount].Height = Me![Employee Name].Height
 
Dennis,

This is exactly what I want to do. I want to set the height of the shorter fields to match the height of a longer field. I have one particular text box that is always longer that the others. However, when I put in the code you gave me, it didn't work. It looks like it should have worked, but it didn't. This is exactly what I typed in:

Me![Risk Number].Height = Me![Prevention/Mitigation].Height

with 'Prevention/Mitigation' being the longest field and 'Risk Number' being the samller field that I want matched with 'Prevention/Mitigation'.

Do you have any suggestion about something else I should have done?

Thanks for your help,
James.

 
James,
It looks like it utilizes the size of the box on the form prior to loading it with data. I've been playing with the CanShrink/CanGrow, but it appears these values can only be set in the Property Box.
I'm still trying to find a solution.
Sorry my previous post didn't work.
D
 
Dennis,

No problem. Thank you so much for your help. I really appreciate.

If you're able to find something that works, please let me know.

Thanks,
James.

PS. I am going to be leaving work in about 15 minutes. If I don't respond to any postings that you send today, it's because I've left for the day and I will reply tomorrow.

Thanks.
 
James,

The problem you're experiencing lies in the fact that the textboxes do not resize themselves until the print event actually occurs. If you examine the height property in the format event, you'll find that every one of them reflect the height that's set in the design -- even your memo boxes. Since you can't change the layout of something once the Print event has begun, you're kind of stuck between a rock and a hard place. I would recommend that you set the borders to your textboxes to be transparent, then using the Line tool, draw an actual line right below them. This solves the problem with getting horizontal lines. Now, you're left with the problem of the vertical lines. In the Detail_Print event, you can use the Line method of the report object to draw a vertical line. For example:

Me.Line(1440,0)-(1440,6000)

This will draw a vertical line 1 inch in from the left edge of the report. The 1440 (twips) = 1 inch. The 6000 is just an arbitrarily large number for the length of the vertical line. When your report runs out of data and cuts the detail section off, the line will not extend past it..

Anyway, I hope this helps!!!

Sean Murphy
 
Sean,

Thank you so much for your help!! I just tried what you suggested and it seems to work perfectly.

Thanks for your help as well Dennis. It was much appreciated.

James.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top