Configuring a label to grow with memo field

  • Thread starter Thread starter seanthompson04
  • Start date Start date
S

seanthompson04

Does anyone know how to get a label box to grow in synch with a memo field?
I am trying to have the borders for the label and memo field equal but
obviously as the memo grow field grows it gets out of synch with the label
borders. Any ideas?
 
Does anyone know how to get a label box to grow in synch with a memo field?
I am trying to have the borders for the label and memo field equal but
obviously as the memo grow field grows it gets out of synch with the label
borders. Any ideas?
The Label can't grow, but you can draw a box around it, sized to the
height of the associated control.

Set the BorderStyle of the Memo control to Solid.
Set it's BorderWidth to Hairline.
Set it's CanGrow property to Yes.
Set the Detail Section CanGrow to Yes.

Set the Label's Top to the same as the Memo control's Top.
Set the Label's BorderStyle to Transparent (no border).

Place the following code in the Detail Section's Print event:

Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single

Me.DrawStyle = 0

lngHeight = Me.MemoControl.Height
X1 = MemoLabelName.Left
X2 = MemoLabelName.Left + Label337.Width
Y1 = MemoLabelName.Top
Y2 =MemoLabelName.Top + lngHeight
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B

Change MemoControl to whatever the actual name of the Memo control is.
Change MemoLabelName to whatever the actual name of the label is.
 
The Label can't grow, but you can draw a box around it, sized to the
height of the associated control.

Set the BorderStyle of the Memo control to Solid.
Set it's BorderWidth to Hairline.
Set it's CanGrow property to Yes.
Set the Detail Section CanGrow to Yes.

Set the Label's Top to the same as the Memo control's Top.
Set the Label's BorderStyle to Transparent (no border).

Place the following code in the Detail Section's Print event:

Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single

Me.DrawStyle = 0

lngHeight = Me.MemoControl.Height
X1 = MemoLabelName.Left
X2 = MemoLabelName.Left + Label337.Width
Y1 = MemoLabelName.Top
Y2 =MemoLabelName.Top + lngHeight
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B

Change MemoControl to whatever the actual name of the Memo control is.
Change MemoLabelName to whatever the actual name of the label is.

Whoops!
Inadvertently neglected to change one value from my test report code.

The X2 = line should read like this:

X2 = MemoLabelName.Left + MemoLabelName.Width
 
That's great, thanks Fred! The only other thing I need to do is shade the
border/box with grey. Is that easy to do as well?

Sean
 
That's great, thanks Fred! The only other thing I need to do is shade the
border/box with grey. Is that easy to do as well?

Sean

I don't understand what you mean by 'shade the border/box with grey.'

If you mean the color of the line, just change vbBlack to whatever
gray color value you wish.

If you mean something else, you'll need to give more information.
 
Thanks again for the quick response.

What I meant was I would like the box filled with a light grey colour. The
box appears and is perfectly aligned, with the correct border ... but I would
like the box to be filed in with light greay rather then the white it is now.

To summarize, I would like the Back Color set to 12632256

Is that possible?

Sean
 
Thanks again for the quick response.

What I meant was I would like the box filled with a light grey colour. The
box appears and is perfectly aligned, with the correct border ... but I would
like the box to be filed in with light greay rather then the white it is now.

To summarize, I would like the Back Color set to 12632256

Is that possible?

Sean

Use:

Me.Line (X1, Y1)-(X2, Y2), 12632256, BF
 
Fred,
I used your code below to work on my report. It worked, but have one small
fix needed. When the Label expands with the memo box, the left side of the
box border is transparent. How do I get it to be solid?

Ben
 
Back
Top