By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,661 Members | 779 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,661 IT Pros & Developers. It's quick & easy.

setting control heights in a report

P: n/a
I've got a report with memo fields set to "CanGrow". Next to this text
box is a combo box. I want the combo box to be as tall as the text box
after it grows. I've tried the following in my code:

ComboBox.Height = TextBox.Height

.... but it's still giving me the height of the text box prior to
growth. Anybody have any solutions?
Sep 5 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Fri, 5 Sep 2008 13:27:35 -0700 (PDT), evenlater wrote:
I've got a report with memo fields set to "CanGrow". Next to this text
box is a combo box. I want the combo box to be as tall as the text box
after it grows. I've tried the following in my code:

ComboBox.Height = TextBox.Height

... but it's still giving me the height of the text box prior to
growth. Anybody have any solutions?
You can use the Line method to draw a box around the control.

1) Better to use a Text control in the report, not a combo box.
You can't use the drop-down in the report anyway, and the box will not
fill in properly using a Combo box.

2) Set the Text (or if you insist, the Combo) control's Border Style
to Transparent.

3) Set the Memo control's Border Style to Solid.

4) Code the Detail 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.Memo.Height
X1 = [TextControl].Left
X2 = [TextControl].Left + [TextControl].Width
Y1 = [TextControl].Top
Y2 = [TextControl] + lngHeight

Me.Line (X1, Y1)-(X2, Y2), 0, B

Change [TextControl] to the actual name of your Text or Combo Box
Control's name.
Change Memo to the actual name of your memo control.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sep 5 '08 #2

P: n/a
Terrific, that's what I'm looking for... EXCEPT: I've actually got one
text box and one combo box (which I've now changed to a text box at
your suggestion) to the left of the memo field that "CanGrow." The
(ex-) combo box has its back color determined at run-time depending on
the value. So now the question is: how can I have the back color of
this middle field extend from the top of the row to the bottom of the
memo field? I can't change the back color of the detail section
because the field on the left needs to be white.

You have an answer for that one too?
Sep 6 '08 #3

P: n/a
On Sat, 6 Sep 2008 13:52:44 -0700 (PDT), evenlater wrote:
Terrific, that's what I'm looking for... EXCEPT: I've actually got one
text box and one combo box (which I've now changed to a text box at
your suggestion) to the left of the memo field that "CanGrow." The
(ex-) combo box has its back color determined at run-time depending on
the value. So now the question is: how can I have the back color of
this middle field extend from the top of the row to the bottom of the
memo field? I can't change the back color of the detail section
because the field on the left needs to be white.

You have an answer for that one too?
What criteria determines the color that you wish to fill in?
What is the color?

Dim lngHeight As Long
Dim X1 As Single
Dim Y1 As Single
Dim Y2 As Single
Dim X2 As Single
Me.DrawStyle = 0

Dim lngX As Long
If [LastName] = "Jones" Then
lngX = vbYellow
Else
lngX = 16777215
End If

lngHeight = Me.Paragraph.Height
X1 = Label1.Left
X2 = Label1.Left + Label1.Width
Y1 = Label1.Top
Y2 = Label1.Top + lngHeight

Me.Line (X1, Y1)-(X2, Y2), lngX, BF

' If you ALSO wish to have a black border around the above colored box
add
Me.Line (X1, Y1)-(X2, Y2), vbBlack, B

End Sub

Change the criteria and the colors as needed.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sep 6 '08 #4

P: n/a
Great, you're making me a very happy programmer. But for some reason
it doesn't seem to be consistently drawing the borders around the
colored boxes even though I do have the two lines:

r.Line (X1, Y1)-(X2, Y2), lngColor, BF
r.Line (X1, Y1)-(X2, Y2), 0, B

Sometimes it has a faint border and sometimes it doesn't... ?
Sep 6 '08 #5

P: n/a
On Sat, 6 Sep 2008 15:38:39 -0700 (PDT), evenlater wrote:
Great, you're making me a very happy programmer. But for some reason
it doesn't seem to be consistently drawing the borders around the
colored boxes even though I do have the two lines:

r.Line (X1, Y1)-(X2, Y2), lngColor, BF
r.Line (X1, Y1)-(X2, Y2), 0, B

Sometimes it has a faint border and sometimes it doesn't... ?
You really should include the relevant portion of the message you are
replying to. Without it, I have to search out the previous message to
see what it is you are talking about.

Is it consistent if you set the DrawWidth property to 5 (or higher)?
Try different values.
Dim ...etc....
Me.DrawStyle = 0
Me.DrawWidth = 5
If [LastName] = "Contessa" Then
......etc....

Other than this I have no idea.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sep 7 '08 #6

P: n/a
Yeah, I did try increasing the DrawWidth and it's still inconsistent.
Thanks for your help.

On Sep 6, 7:57*pm, fredg <fgutk...@example.invalidwrote:
On Sat, 6 Sep 2008 15:38:39 -0700 (PDT), evenlater wrote:
Great, you're making me a very happy programmer. But for some reason
it doesn't seem to be consistently drawing the borders around the
colored boxes even though I do have the two lines:
r.Line (X1, Y1)-(X2, Y2), lngColor, BF
r.Line (X1, Y1)-(X2, Y2), 0, B
Sometimes it has a faint border and sometimes it doesn't... ?

You really should include the relevant portion of the message you are
replying to. Without it, I have to search out the previous message to
see what it is you are talking about.

Is it consistent if you set the DrawWidth property to 5 (or higher)?
Try different values.
Dim ...etc....
Me.DrawStyle = 0
Me.DrawWidth = 5
If [LastName] = "Contessa" Then
.....etc....

Other than this I have no idea.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Sep 7 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.