Auto sizing fields together

jjake

Registered User.
Local time
Today, 14:30
Joined
Oct 8, 2015
Messages
291
Ok so I decided to make a new thread since I made a mess of my last one.

Here is my problem. I have numerous fields side by side on a purchase order that relate to each record.

If I have a product that has a super long description, I have set the field so it will auto expand. The problem is the corresponding fields next to it stay the original size. I would like them to expand with that one record so it all stays proportional on the page.

I will use this page for printing and for saving as a PDF to email to vendors.

I have attached a picture showing my issue.

Thanks.
 

Attachments

  • Purchase Order Problem1.jpg
    Purchase Order Problem1.jpg
    97.5 KB · Views: 132
Off-hand, I do not think there is any built-in mechanism for this. But you could make the boarders of all textboxes invisible, and underneath the leftmost textbox make a horizontal line spanning the column. That line would get pushed by the highest textbox, and would in turn push those underneath.

I seem to recall a thread here on AWF about variable vertical lines in reports - you'd have to google it.
 
I think that if you do a search you'll find that someone has already asked this question and I've already answered with a decent solution.

I would post it again, but I deleted it off my computer. sorry
 
are those lines, or control borders. is setting the cangrow of the other controls will solve this?
 
are those lines, or control borders. is setting the cangrow of the other controls will solve this?

They are control borders. I have set them to cangrow as well but they do not because the text in that particular box fits.
 
can you do it in the Format event of the Detail section of your report:


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.yourCostCenterControl.Height = Me.yourItemDescriptionControl.Height
Me.yourQuantityControl.Height = Me.yourItemDescriptionControl.Height
Me.yourUnitPriceControl.Height = Me.yourItemDescriptionControl.Height
Me.yourUnitTotalControl.Height = Me.yourItemDescriptionControl.Height
End Sub
 
can you do it in the Format event of the Detail section of your report:


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.yourCostCenterControl.Height = Me.yourItemDescriptionControl.Height
Me.yourQuantityControl.Height = Me.yourItemDescriptionControl.Height
Me.yourUnitPriceControl.Height = Me.yourItemDescriptionControl.Height
Me.yourUnitTotalControl.Height = Me.yourItemDescriptionControl.Height
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.CostCenter.Height = Me.ItemDescription.Height
Me.Qty.Height = Me.ItemDescription.Height
Me.UnitPrice.Height = Me.ItemDescription.Height
Me.UnitTotal.Height = Me.ItemDescription.Height
End Sub

These are my names. It didn't have any effect.
 
try print event rather than format

although the problem might be that access/vba cannot anticipate what size the control will grow to.
 
Oh uhm, If it does work for you, you would have to sub Width for Height and Left for Top
 
And I'm getting the feel that I don't completely understand your issue lol
 
Off-hand, I do not think there is any built-in mechanism for this. But you could make the boarders of all textboxes invisible, and underneath the leftmost textbox make a horizontal line spanning the column. That line would get pushed by the highest textbox, and would in turn push those underneath.

I seem to recall a thread here on AWF about variable vertical lines in reports - you'd have to google it.

This method works great to separate each record from each other.

I just wish I could do something similar to break up the fields from each other. If I try the same method vertically the line looks out of place.
 
I also gave you a plan B in my post which you obviously haven't executed. The answer is in fact given on AWF.
 
I also gave you a plan B in my post which you obviously haven't executed. The answer is in fact given on AWF.

I have managed to find this script which gives me a perfect vertical line as I need it

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Color As Long
' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 5 ' Specify that measurement occur in inches.
' Set line to print 5 inches from the left margin.
X1 = 0.0833
X2 = 0.0833
' Set line to print from the top of the detail section
' to a maximum height of 22 inches.
Y1 = 0
Y2 = 22
Me.DrawWidth = 8 ' Width of the line (in pixels). Note: Some printers do not accept odd numbers.
Color = RGB(0, 0, 0) ' Use black line color.
' Draw the line with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color



End Sub

The text in red dictates where the line starts from the left of the page (X1) and where the line ends (X2) for a straight vertical line, (X1) and (X2) remain the same. Now my issue is, this is for one single line... How do I adapt this script so I can do multiple lines?
 
on your Detail Section property, are these set to Yes:

Auto Height
Can Grow
Can Shrink

if not set it to Yes.
 
X1 and X2 are the distance from the left edge as you noted. You can redefine them after each line is drawn and draw a new line.

Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
Dim X1 As Single, Y1 As Single
Dim X2 As Single, Y2 As Single
Dim Color As Long
' Specify unit of measurement for coordinates on a page...
Me.ScaleMode = 5 ' Specify that measurement occur in inches.
' Set line to print 5 inches from the left margin.
X1 = 0.0833
X2 = 0.0833
' Set line to print from the top of the detail section
' to a maximum height of 22 inches.
Y1 = 0
Y2 = 22
Me.DrawWidth = 8 ' Width of the line (in pixels). Note: Some printers do not accept odd numbers.
Color = RGB(0, 0, 0) ' Use black line color.
' Draw the line with the Line method.
Me.Line (X1, Y1)-(X2, Y2), Color

'Second line
X1 = 3
X2 = 3

Me.Line (X1, Y1)-(X2, Y2), Color

'And so on...

End Sub
 
on your Detail Section property, are these set to Yes:

Auto Height
Can Grow
Can Shrink

if not set it to Yes.

I changed them to yes and it still has no effect except shrinking some of my text boxes.
 

Users who are viewing this thread

Back
Top Bottom