A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using VBA to hide a report's detail section?



 
 
Thread Tools Display Modes
  #1  
Old May 24th, 2010, 09:02 PM posted to microsoft.public.access.reports
Paul Kraemer
external usenet poster
 
Posts: 80
Default Using VBA to hide a report's detail section?

Hi,
I am using Access 2007. I have created a report with a detail section and
some summary information in the group header. Sometimes I want to see the
detail section, but other times I would like the detail section to be hidden
so that I only get the summary info. Can anyone tell me if there is a
relatively easy way I can give myself this choice each time I run the report
using VBA? If so, if you could give me a quick sample of how to reference a
report's detail section and tell me what is the best event to use if I want
to set the .Visible property to False, I'd really appreciate it.

Or is it easiest to just create two reports, one with the Detail section
visible and one with the detail section not visible?

Thanks in advance,
Paul
--
Paul Kraemer
  #2  
Old May 24th, 2010, 10:00 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Using VBA to hide a report's detail section?

Don't create multiple reports. You should have a form with a command button
that opens the report. Add a check box to the form "chkHideDetails". Then add
code to the On Format event of the detail section of the report:

Cancel = Forms!frmYourNameHere!chkHideDetails

--
Duane Hookom
Microsoft Access MVP

NOTE: These public News Groups are ending June 1st. Consider asking
questions at http://social.answers.microsoft.com/...ddbuz/threads?


"Paul Kraemer" wrote:

Hi,
I am using Access 2007. I have created a report with a detail section and
some summary information in the group header. Sometimes I want to see the
detail section, but other times I would like the detail section to be hidden
so that I only get the summary info. Can anyone tell me if there is a
relatively easy way I can give myself this choice each time I run the report
using VBA? If so, if you could give me a quick sample of how to reference a
report's detail section and tell me what is the best event to use if I want
to set the .Visible property to False, I'd really appreciate it.

Or is it easiest to just create two reports, one with the Detail section
visible and one with the detail section not visible?

Thanks in advance,
Paul
--
Paul Kraemer

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.