Same Row Height

A

access freshman

I have created a report in MS Access. The report looks much like an excel
spreadsheet. Every text box and the Detail section is set to CanGrow.

How can I set the entire detail section to be the same height and adjust
size according to the largest text box in the section?
 
W

Wayne-I-M

Open the report in design view
Select the largest "text box"
Right click to open the properties box
Select format column
Select Height and cut it.

Drag the mouse over the entire details section and paste the height in the
Height row.

Hope this helps
 
D

Douglas J. Steele

I'm suspecting that they're all set to the same value now, but that because
of the CanGrow settings, they change once they're populated with data so
that access freshman is hoping be able to change them dynamically.

In the Print event of each section, you'll need to loop through all of the
controls on the report, checking the height of each text box to determine
the largest one. You'll then need to loop through all of the controls on the
report again, setting the height to that maximum value.

Dim ctlCurr As Control
Dim lngMax As Long

For Each ctlCurr In Me.Controls
If ctlCurr.ControlType = acTextBox Then
If ctlCurr.Height > lngMax Then
lngMax = ctlCurr.Height
End If
End If
Next ctlCurr

For Each ctlCurr In Me.Controls
If ctlCurr.ControlType = acTextBox Then
ctlCurr.Height = lngMax
End If
Next ctlCurr
 
A

access freshman

Thanks, but I already did that. I want every text to grow to the same height.
 
A

access freshman

Doug put your code in the Detail section and tried to run the report and got
the following error message:

Run-time error '2191'
You can't set the Height property in print preview or after printing has
started.

What do I do??
 
D

Douglas J. Steele

What event did you put it in?

I just realized that the sample I based that on doesn't actually reset the
heights of the text boxes. What it does is set the height of lines drawn
around the text boxes so that they're all the same size.
 
A

access freshman

Doug,
My text boxes are conditional formatted so I would like to be able to expand
them all equally to the same height. Is there a code for that?
 
D

Douglas J. Steele

To be honest, I don't know: I never use conditional formatting.

Did you try putting the code in the Print event, as I suggested?
 
A

access freshman

Yes, I put the code in. It works for the lines. So I can get lines expanding,
but the text boxes remain at various heights. B/c I have conditional
formatting for the text boxes, the different shading really looks uneven in
the row.
 
A

access freshman

I double checked to make sure I put in the right code... I did. It does not
work.
 
D

Douglas J. Steele

Into what event did you put the code? (I'm assuming that "it does not work"
just means nothing happens. If there are any error messages, what are they?)
 
A

access freshman

Put the code in the Detail section and tried to run the report and got
the following error message:

Run-time error '2191'
You can't set the Height property in print preview or after printing has
started.
 
D

Douglas J. Steele

Sorry, no additional ideas.

You might try posting to the Access Reports newsgroup.
 

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