Skipping record in labels report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to code or syntax for skipping record if Client Name is too long.

Should this code go in On Format or On Print
 
Just update your query. Add a new field that will display the length of the
field and then put in criteria to exclude records where the length is longer
than desired.


LenghtOfName: Len([somefieldname])
<XX
 
This is my current code. I want if, the [ClientName] > 27 to print "NAME NO
LONG" instead.

If Len([ClientName]) > 20 Then
[ClientName].FontSize = 10
[HealthID].FontSize = 10
Else
[ClientName].FontSize = 14
[HealthID].FontSize = 14
End If


Rick B said:
Just update your query. Add a new field that will display the length of the
field and then put in criteria to exclude records where the length is longer
than desired.


LenghtOfName: Len([somefieldname])
<XX

--
Rick B



iholder said:
I need to code or syntax for skipping record if Client Name is too long.

Should this code go in On Format or On Print
 
Your problem is that the ClientName control is bound to the ClientName field.
The value displayed by a bound control cannot be changed on a report. Several
Options - here are two.

Option One
Add a Label to your report, name it "labelNameTooLong" (or whatever you prefer),
set its caption to "NAME TOO LONG", and put it over (or under) your client name
control.

In the Details Format event add code to show./hide the controls
If Len([ClientName]) > 27 Then
Me.ClientName.Visible = False
Me.labelNameTooLong.Visible = True
ELSE
Me.ClientName.Visible = True
Me.labelNameTooLong.Visible = False
end if

If Len([ClientName]) > 20 Then
[ClientName].FontSize = 10
[HealthID].FontSize = 10
Else
[ClientName].FontSize = 14
[HealthID].FontSize = 14
End If


Option Two
Unbind the control, rename it to TxtClientName and set its value in code

If Len([ClientName]) > 27 Then
Me.txtClientName= "NAME TOO LONG"
ELSE
Me.TxtClientName=[ClientName]
end if

This is my current code. I want if, the [ClientName] > 27 to print "NAME NO
LONG" instead.

If Len([ClientName]) > 20 Then
[ClientName].FontSize = 10
[HealthID].FontSize = 10
Else
[ClientName].FontSize = 14
[HealthID].FontSize = 14
End If

Rick B said:
Just update your query. Add a new field that will display the length of the
field and then put in criteria to exclude records where the length is longer
than desired.


LenghtOfName: Len([somefieldname])
<XX

--
Rick B



iholder said:
I need to code or syntax for skipping record if Client Name is too long.

Should this code go in On Format or On Print
 
Back
Top