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 / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Report gets run-time error "2427"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JimN - 03 Aug 2005 19:33 GMT
A report, with a subreport, has an "On Print" event to the MainReport. Then
"Run-Time Error "2427": You entered an expression that has no value. ",
appears and on "Debug" the code line: "If
Left([Reports]![MainReport]![SubReport].[Report]![Course#],1)=”8” Then" is
highlighted. The "Help" button brings up a blank screen. The source for both
forms has data. What is the cause and fix? The coding is as follows:
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If Left([Reports]![MainReport]![SubReport].[Report]![Course#],1)=”8” Then
        Reports!MainReport!SubReport.Report!SupplyFee=0
    Else
        Reports!MainReport!SubReport.Report!SupplyFee=20
    End If
Allen Browne - 04 Aug 2005 03:17 GMT
If there are no records to print in a subreport for the record in the main
report, Access prints nothing for the subreport. If you code tries to refer
to the text box in the subreport, it does not exist, and so your code
generates an error.

To avoid that, test the HasData property of the subreport before referring
to the controls:
   With Me.[SubReport].Report
       If .HasData Then
           If ![Course#] = "8" Then
               !SupplyFee = 0
           Else
               !SupplyFee = 20
           End If
       End If
   End With

It might be easier to use this as the Control Source for SupplyFee text box
in the subreport, with no code needed:
   =IIf([Course#]="8", 0, 20)

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>A report, with a subreport, has an "On Print" event to the MainReport. Then
> "Run-Time Error "2427": You entered an expression that has no value. ",
[quoted text clipped - 9 lines]
> Reports!MainReport!SubReport.Report!SupplyFee=20
> End If
 
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.