Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old September 5th, 2008, 09:35 PM
evenlater
Guest
 
Posts: n/a
Default setting control heights in a report

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?
  #2  
Old September 6th, 2008, 12:15 AM
fredg
Guest
 
Posts: n/a
Default Re: setting control heights in a report

On Fri, 5 Sep 2008 13:27:35 -0700 (PDT), evenlater wrote:
Quote:
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
  #3  
Old September 6th, 2008, 09:55 PM
evenlater
Guest
 
Posts: n/a
Default Re: setting control heights in a report

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?
  #4  
Old September 6th, 2008, 11:15 PM
fredg
Guest
 
Posts: n/a
Default Re: setting control heights in a report

On Sat, 6 Sep 2008 13:52:44 -0700 (PDT), evenlater wrote:
Quote:
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
  #5  
Old September 6th, 2008, 11:45 PM
evenlater
Guest
 
Posts: n/a
Default Re: setting control heights in a report

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... ?
  #6  
Old September 7th, 2008, 02:05 AM
fredg
Guest
 
Posts: n/a
Default Re: setting control heights in a report

On Sat, 6 Sep 2008 15:38:39 -0700 (PDT), evenlater wrote:
Quote:
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
  #7  
Old September 7th, 2008, 07:15 PM
evenlater
Guest
 
Posts: n/a
Default Re: setting control heights in a report

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:
Quote:
On Sat, 6 Sep 2008 15:38:39 -0700 (PDT), evenlater wrote:
Quote:
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:
>
Quote:
r.Line (X1, Y1)-(X2, Y2), lngColor, BF
r.Line (X1, Y1)-(X2, Y2), 0, B
>
Quote:
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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles