Link to home
Start Free TrialLog in
Avatar of David_W_R
David_W_R

asked on

How to set visible parameter of a control on a report in VBA

From a separate VB module, I open a Report in acPreview mode (or acViewDesign mode), and attempt to set the visibility of a control based on the value of another control in the same report per the code below.  

                DoCmd.OpenReport SummaryReportName, acPreview, , "HHID = " & ClientNowPrinting
                Debug.Print "This should print"
                Debug.Print "Text135 = " & [RpQtr - Performance131231Charts]!Text135
                Debug.Print "text199 visible = " & [RpQtr - Performance131231Charts]!Text199.Visible
                If [RpQtr - Performance131231Charts]!Text135 <> 0 Then
                    [RpQtr -Performance131231Charts]!Text199.Visible = False
                End If

The Report loads fine, and subsequently prints, but my attempt to set control visibility before printing is fruitless.  Any line of code having the name of the report just seems to be ignored, even the debug.print commands.  The "This should print" line does print in the Immediate window, but the lines following do not print.  The variable SummaryReportName = "RpQtr - Performance131231Charts"

Is it not possible to read the value in controls of a Report and change them from code in another module?  If it is possible, what am I doing wrong?
SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
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
David_W_R

ASKER

Many good points here.  Quite a tutorial!  Many thanks to each contributor.   "Best" answer was the one that went furthest to solve the problem, but more nuggets in the others.  Great to have a roomful of experienced teachers!