Avatar of David_W_R
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
Microsoft Access

Avatar of undefined
Last Comment
David_W_R

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Rey Obrero (Capricorn1)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
David_W_R

ASKER
Thanks for the guidance.  Who knew one could not address and use Report control values!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck