Text Boxes Automatically goes larger (1 Viewer)

stu_c

Registered User.
Local time
Today, 07:15
Joined
Sep 20, 2007
Messages
489
Hi All
I have a form that we type the info in, once this is done it goes to a report in a specific layout and is printed.

we have 5 columns of text boxes, my question is if you type in the form the text box goes larger depending on the amount of text, is it possible for the other text boxes either side of it to go to the same size?

I have attached a quick example of what I mean, basically as you can see the second column has grown but is it possible for 1 and 3 columns to automatically grow to the same size?
 

Attachments

  • ScreenShot.png
    ScreenShot.png
    10.2 KB · Views: 120

Minty

AWF VIP
Local time
Today, 07:15
Joined
Jul 26, 2013
Messages
10,371
As far as I know you can only do this in code, I think in the Detail_Format event, by examining the height of the largest control and setting the other texboxes size to match. Air Code something like;

Me.txtCompanyName.Height = Me.txtVisitors.Height
 

stu_c

Registered User.
Local time
Today, 07:15
Joined
Sep 20, 2007
Messages
489
Many thanks
what coding do I use?

Private Sub Detail_Format ()
Me.txtCompanyName.Height = Me.txtVisitors.Height


As far as I know you can only do this in code, I think in the Detail_Format event, by examining the height of the largest control and setting the other texboxes size to match. Air Code something like;

Me.txtCompanyName.Height = Me.txtVisitors.Height
 

Minty

AWF VIP
Local time
Today, 07:15
Joined
Jul 26, 2013
Messages
10,371
Yes - something like that. Press the code builder on the report detail format event.
Replace txtCompanyName and txtVisitors with your control names.

Bear in mind that if your company name text is really long and you only have one visitor the boxes might not be sized correctly. You might want to check for the largest size of all three controls before setting them.
 

stu_c

Registered User.
Local time
Today, 07:15
Joined
Sep 20, 2007
Messages
489
Hi mate I can't find the detail format event where abouts is it as it's not under the normal events steps :/

Yes - something like that. Press the code builder on the report detail format event.
Replace txtCompanyName and txtVisitors with your control names.

Bear in mind that if your company name text is really long and you only have one visitor the boxes might not be sized correctly. You might want to check for the largest size of all three controls before setting them.
 

Minty

AWF VIP
Local time
Today, 07:15
Joined
Jul 26, 2013
Messages
10,371
Click on the actual Detail "header" grey box.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:15
Joined
May 7, 2009
Messages
19,241
select all fields in the Detail
Section of the report and include
the Page Header label controls.

On Ribbon->Arrange->Tabular

while still at Arrange Menu,
select Control Padding = None.

On the Property Sheet->Format
Border Style = Solid.
 

Minty

AWF VIP
Local time
Today, 07:15
Joined
Jul 26, 2013
Messages
10,371
Hi Arnelgp, does that work to grow the smaller boxes - I've never seen that behaviour?

I've jumped through some serious code hoops to get reports with text boxes to grow and shrink in a "nice" way.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:15
Joined
May 7, 2009
Messages
19,241
yes Minty, i think the OP
fields in the report are not
Grouped (Arrange in Ribbon Tab),
that is why when one field grows,
the others don't follow.

although there are other alternatives
like using the Line() method of the
report to draw those lines, eg:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Line (Me.ID.Left, 0)-(Me.ID.Left, 500000000), vbGrayText
Line (Me.FirstName.Left, 0)-(Me.FirstName.Left, 500000000), vbGrayText
Line (Me.MemoField.Left, 0)-(Me.MemoField.Left, 500000000), vbGrayText
Line (Me.MemoField.Left + Me.MemoField.Width, 0)-(Me.MemoField.Left + Me.MemoField.Width, 500000000), vbGrayText
Line (Me.ID.Left, 500000000)-(Me.MemoField.Left + Me.MemoField.Width, 500000000), vbGrayText
End Sub

don't bother about 500000000 (long line), since the
report will actually truncate that to the longest
field in the report (another trick to avoid
determining which field is the tallest).
 

Minty

AWF VIP
Local time
Today, 07:15
Joined
Jul 26, 2013
Messages
10,371
Ah - I see grouped controls grow together - I did not know that!
Thank you!.
 

stu_c

Registered User.
Local time
Today, 07:15
Joined
Sep 20, 2007
Messages
489
Thank you it worked :)

another quick thing as the columns grow is there a way to make the text always be vertically centre of the box?

select all fields in the Detail
Section of the report and include
the Page Header label controls.

On Ribbon->Arrange->Tabular

while still at Arrange Menu,
select Control Padding = None.

On the Property Sheet->Format
Border Style = Solid.
 

Users who are viewing this thread

Top Bottom