Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / July 2005

Tip: Looking for answers? Try searching our database.

Skipping record in labels report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iholder - 27 Jul 2005 16:40 GMT
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
Rick B - 27 Jul 2005 16:43 GMT
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

Signature

Rick B

> 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
iholder - 27 Jul 2005 18:04 GMT
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

> 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
[quoted text clipped - 6 lines]
> >
> > Should this code go in On Format or On Print
John Spencer (MVP) - 30 Jul 2005 20:05 GMT
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.
[quoted text clipped - 20 lines]
> > >
> > > Should this code go in On Format or On Print
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.