Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Synchronizing the height of the text box and memo

Status
Not open for further replies.

kram327

Technical User
Feb 12, 2004
10
US
Hi all,

The reports of the database i have created should be in tabular form. How can i synchronize the height of the textbox and memo during runtime? So that it will still look like in a tabular format.
The memo grows whenever it has a long value in it leaving the textbox in its original height.
I hope you will able to help me.

Note: The text box is also set to "can grow".

Mark
 
In the On Open event of the report set the height of the textbox equal to that of the memo.

Private Sub Report_Open(Cancel As Integer)

Me.YourTextField.Height = Me.YourMemoField.Height

End Sub

Hope this helps.

 
cghoga,
Have you gotten this to work and if so, which version of Access?

I have found that I needed code in the On Print event of the section containing the controls. The code determined the "grown" height of the memo field text box and then used the report Line method to draw boxes around all text boxes.

There is sample code in the calendar reports (standard calendar) at that draws rectangles based on a maximum height.

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Absolutely. It works fine on my machine (else I would not have posted).
But maybe that's the problem, it's MY machine.
I'm using Access 2000 if this helps.



 
cghoga,
There is no way that the On Open event of the report will ever know how tall a text box might end up when it is set to can grow. Besides as the memo field will fluctuate in size, the "size" of the box around the text field must re-size.

I tried your code and it did not work. This code should work as long as the memo text box is the tallest text box and their top property value is the same:
Code:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    Dim lngHeight As Long
    lngHeight = Me.YourMemoField.Height
    Me.Line (Me.YourTextField.Left, Me.YourTextField.Top) _
        -Step(Me.YourTextField.Width, lngHeight), , B
    
End Sub

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 

Guys,

I appreciate all the help you do. But Duane is right.
Thanks.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top