Change FontSize if Length to long in Report

PShiers

Registered User.
Local time
Today, 21:34
Joined
May 2, 2009
Messages
26
This feel like a very basic question, but I just can't get it to work.

What I want is if the 'CustRef' field is greater then 15, then to change the fontsize to 8pt. Below is the code I'm using...

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If Len(Custref) > 15 Then
Custref.FontSize = 8
Else
Custref.FontSize = 10
End If
End Sub

Any ideas gratefully received
 
This feel like a very basic question, but I just can't get it to work.

What I want is if the 'CustRef' field is greater then 15, then to change the fontsize to 8pt. Below is the code I'm using...

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
If Len(Custref) > 15 Then
Custref.FontSize = 8
Else
Custref.FontSize = 10
End If
End Sub

Any ideas gratefully received

Are you getting an error message?

Is the control named "Custref" actually in the page header section?

I think you need to use the On Print event.


Try:
Code:
Private Sub PageHeaderSection_[b]Print[/b](Cancel As Integer, FormatCount As Integer)
    If Len(Me.Custref) > 15 Then
        Me.Custref.FontSize = 8
    Else
        Me.Custref.FontSize = 10
    End If
End Sub
 
Thanks for the reply.

The answer was simple, and feel a bit foolish

The object was not correctly named 'custref'

Renamed and it works fine 'on format' didn't need to move the code to 'On Print'

Thanks once again
 

Users who are viewing this thread

Back
Top Bottom