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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count max characters in columns longest record

Status
Not open for further replies.

sqlJunior

Technical User
Sep 22, 2002
123
TH

I have a report with a column in which I need to reduce the font size from 8 to 7 when the amount of characters in the longest record exceeds 28.

How can I write a statement that will achieve this.
 

Try this in the On_Format event of the report

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Len([FieldName]) > 28 Then
Me.FieldName.FontSize = 7
Else
Me.FieldName.FontSize = 8
End If

End Sub
 
Thanks HomeAlone
You've solved my problem.

I found I has to use Me! instead of Me. and it works perfectly.

If Len([LineNo]) > 28 Then
Me!txtLineNo.FontSize = 7
Else
Me!txtLineNo.FontSize = 8
End If

Really appreciate your help

SqlJunior
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top