Conditional formating in reports - Access 2003

A

akidner

I would like to adjust the height of items with in the detail section of an
Access report based upon the amount of data to display.

So far I have got the detail height to adjust by calling this function from
a text box in the detail section of the report. This works BUT not until two
records/rows below the record I want to change!

Private Function SetHeight() As Long
Dim lngMyLen As Long
Let lngMyLen = Len(Me.txtTuesdayAM)
If lngMyLen > 20 Then
Me.Detail.Height = 1100 '567 twips equals 1 cm
Else
Me.Detail.Height = 373
End If
Let SetHeight = lngMyLen
End Function

Can anyone tell me how to correct this or indeed tell me a more simple
approach.

Many thanks.
 
M

Marshall Barton

akidner said:
I would like to adjust the height of items with in the detail section of an
Access report based upon the amount of data to display.

So far I have got the detail height to adjust by calling this function from
a text box in the detail section of the report. This works BUT not until two
records/rows below the record I want to change!

Private Function SetHeight() As Long
Dim lngMyLen As Long
Let lngMyLen = Len(Me.txtTuesdayAM)
If lngMyLen > 20 Then
Me.Detail.Height = 1100 '567 twips equals 1 cm
Else
Me.Detail.Height = 373
End If
Let SetHeight = lngMyLen
End Function

Can anyone tell me how to correct this or indeed tell me a more simple
approach.


The text box's (and the detail section's) CanGrow property
is the standard way to deal with this issue.

Note: Unless you are using a fixed width font, the number of
characters is only vaguely related to the amount of space
needed to display those characters. You will also have to
remember to chave the Height settings in your code if you
ever decide to change the text box's Font, FontSize, Bold or
Italic properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top