Link to home
Start Free TrialLog in
Avatar of David_W_R

asked on

How to reference controls on an open Report

This code segment opens a report with the name "rpQtr-Performance150930QTR-ex" and needs to test the value of a textbox on the Report to determine whether to print the report.  The "If Reports!..." statement doesn't appear to be working.  I halted execution and stepped thru the code to confirm that VB doesn't recognize the format I used.

When I test it in the Immediate window, I get the error:  "You entered an expression that has no value"

DoCmd.OpenReport QtrNonBillableReportName, acViewPreview, , "HHID = " & ClientNowPrintingDoCmd.RunCommand acCmdPreviewFourPages

If PauseBeforeClosingSection Then MsgBox ("Proceed")
If Not ViewOnly Then
       If Reports![rpQtr-Performance150930QTR-ex].txtQTRbegin <> 0 And Me!txtQTRbegin <> 0 Then
           Totalpages = Reports(QtrNonBillableReportName).Pages
            DoCmd.PrintOut acPages, 2, Totalpages - 1, acHigh
      End If
End If
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David_W_R


Thanks for the guidance.  Who knew one could not address and use Report control values!