PC Review


Reply
Thread Tools Rate Thread

Can I programmatically hide subreports?

 
 
Robin
Guest
Posts: n/a
 
      24th Feb 2006
I have a report which contains a number of subreports and I wish to
show/hide these based on user checkbox choices on a form before the report
is opened. I can manually hide the subreports by changing their visible
property. Is this possible from vbe and if so, do the subreports (or the
main report) need to be open at the time, and could someone possibly give me
a clue as to the syntax?

I seem to be going round in circles at the moment!

Thx

Robin


 
Reply With Quote
 
 
 
 
SusanV
Guest
Posts: n/a
 
      24th Feb 2006
in the main form's on current event (set the actual control names for your
project)


Me.YourSubformName.Visible = (Me.YourCheckboxName = true)

--
hth,
SusanV


"Robin" <(E-Mail Removed)> wrote in message
news:eHE9Y$(E-Mail Removed)...
>I have a report which contains a number of subreports and I wish to
>show/hide these based on user checkbox choices on a form before the report
>is opened. I can manually hide the subreports by changing their visible
>property. Is this possible from vbe and if so, do the subreports (or the
>main report) need to be open at the time, and could someone possibly give
>me a clue as to the syntax?
>
> I seem to be going round in circles at the moment!
>
> Thx
>
> Robin
>



 
Reply With Quote
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      24th Feb 2006
Robin:

In the Format event procedure of whichever section of the parent report the
subreport is in put:

On Error resume Next
SubReportControl.Visible = Forms!YourForm!YourCheckBox

If the check box is checked (TRUE) the subreport will be visible, if not
(FALSE) it will be hidden. Note that SubReportControl is the name of the
subreport control in the parent report, i.e. the control which houses the
subreport, not the name of its underlying Report object.

The error handling means the line will be ignored if the form is not open,
e.g. if the report is opened directly from the database window.

Ken Sheridan
Stafford, England

"Robin" wrote:

> I have a report which contains a number of subreports and I wish to
> show/hide these based on user checkbox choices on a form before the report
> is opened. I can manually hide the subreports by changing their visible
> property. Is this possible from vbe and if so, do the subreports (or the
> main report) need to be open at the time, and could someone possibly give me
> a clue as to the syntax?
>
> I seem to be going round in circles at the moment!
>
> Thx
>
> Robin


 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      24th Feb 2006
Thank you Ken - worked perfectly!

I perhaps should have added to my question, the fact that I wasn't opening
the main report directly, but was using OutputTo acOutputReport to export
the report to a rtf document - but this solution still works!

Thanks again.

R

"Ken Sheridan" <(E-Mail Removed)> wrote in message
news:F50D3BB8-5D54-4745-816B-(E-Mail Removed)...
> Robin:
>
> In the Format event procedure of whichever section of the parent report
> the
> subreport is in put:
>
> On Error resume Next
> SubReportControl.Visible = Forms!YourForm!YourCheckBox
>
> If the check box is checked (TRUE) the subreport will be visible, if not
> (FALSE) it will be hidden. Note that SubReportControl is the name of the
> subreport control in the parent report, i.e. the control which houses the
> subreport, not the name of its underlying Report object.
>
> The error handling means the line will be ignored if the form is not open,
> e.g. if the report is opened directly from the database window.
>
> Ken Sheridan
> Stafford, England
>
> "Robin" wrote:
>
>> I have a report which contains a number of subreports and I wish to
>> show/hide these based on user checkbox choices on a form before the
>> report
>> is opened. I can manually hide the subreports by changing their visible
>> property. Is this possible from vbe and if so, do the subreports (or the
>> main report) need to be open at the time, and could someone possibly give
>> me
>> a clue as to the syntax?
>>
>> I seem to be going round in circles at the moment!
>>
>> Thx
>>
>> Robin

>



 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      24th Feb 2006
Thank you! I was struggling to achieve this from code relating to the check
boxes - You made me realise that I should have been looking at code for the
report.

Thx.

Robin

"SusanV" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> in the main form's on current event (set the actual control names for your
> project)
>
>
> Me.YourSubformName.Visible = (Me.YourCheckboxName = true)
>
> --
> hth,
> SusanV
>
>
> "Robin" <(E-Mail Removed)> wrote in message
> news:eHE9Y$(E-Mail Removed)...
>>I have a report which contains a number of subreports and I wish to
>>show/hide these based on user checkbox choices on a form before the report
>>is opened. I can manually hide the subreports by changing their visible
>>property. Is this possible from vbe and if so, do the subreports (or the
>>main report) need to be open at the time, and could someone possibly give
>>me a clue as to the syntax?
>>
>> I seem to be going round in circles at the moment!
>>
>> Thx
>>
>> Robin
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide empty data in subreports =?Utf-8?B?TVRzdHJhdw==?= Microsoft Access 8 10th Jul 2007 03:16 PM
Hide Duplicate Subreports =?Utf-8?B?SUxvdmVBY2Nlc3M=?= Microsoft Access Reports 3 25th May 2005 07:49 PM
Hide Directory programmatically =?Utf-8?B?RUs=?= Microsoft Dot NET Framework 1 29th Nov 2004 11:28 AM
Hide SubReports with no data BUT still include them in Grand Total calculation James Microsoft Access Reports 2 14th Nov 2004 10:57 PM
Subreports, hide when no data Lee T. Microsoft Access Reports 1 23rd Jun 2004 06:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:36 AM.