We help IT Professionals succeed at work.
Get Started

How to reference controls on an open Report

David_W_R
David_W_R asked
on
55 Views
Last Modified: 2015-10-12
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
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE