Set report controls visible property depending on value

Tech-Archive recommends: Fix windows errors by optimizing your registry



I'm struggling to control whether a text box in a subreport prints. I'm
trying to set the control's visible property (using VBA) to true or false
depending on the value of the control.
I'm doing this because depending on the record I'm dealing with, only one of
two fields will appear and I want to show different data depending on the
data in one of the two fields.

Unfortunately, I can't seem to get access to the value of the control from
within VBA. Despite trying many different formats to access the value, I
get either a"can't find the field" or a "has no value" error.
I've tried things like: If [txtValue] is null then...
If me.[txtValue] is null then...
If Query.qrySR1.[txtValue] is null then...


Report: rptReport1
SubReport: rptSR1
Query used in report: qryReport1
Query used in subreport: qrySR1
Field from query qrySR1 whose value I'm trying to access (also the control
name): txtValue

Here are some specific questions:

1) Is controlling the control's visible property from VBA the appropriate
way to show or hide a control in a report?
2) If so, under what event should I be placing my code?
3) How do I access the variable's value? What is the proper code to address
the value?
4) How else can I accomplish this?

Thank you!

-Clint Marshall


.



Relevant Pages

  • Re: Set report controls visible property depending on value
    ... The correct VBA syntax to check for a Null value in the control is ... You would set the visible property in the Format event ... control when Null to get rid of a vertical space it creates in the report, ...
    (microsoft.public.access.reports)
  • Re: Set report controls visible property depending on value
    ... Is there any way to identify whether a control has a null value for all ... You would set the visible property in the Format ... > the report, you may also want to check the Can Shrink property of the ... >> trying to set the control's visible property (using VBA) to true or false ...
    (microsoft.public.access.reports)
  • Re: ZOrder
    ... Why don't you toggle the Visible property of ... I have a form with an ActiveX control and native controls. ... How can I make it display on top in Access VBA ...
    (microsoft.public.access.modulesdaovba)
  • viewing recordset reults from vba
    ... The SQL is built up in VBA ... depending on control values set in the form. ... display the resulting recordset to the user? ...
    (microsoft.public.access.queries)
  • Freds approximately devoteing
    ... My liable mosaic won't control before I formulate it. ... He can dramatically sense depending on Sayed when the mysterious ... positively rescue invasions, the scents often freeze with regard to the ... Get your altogether servicing show over my obstacle. ...
    (sci.crypt)