Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making Detail Section Not Visible Before Opening 1

Status
Not open for further replies.

GoatieEddie

Technical User
Nov 3, 2003
177
CA
Hi all,

I have a report with several subreports in it.

I want to have a button on a form that allows either the full report to be run or the report with the detail sections hidden (ie just summary data).

I have used this line in a module to effect one of the subreports:

Reports![Accounts Opened Over Period].Section(acDetail).Visible = False

but the report needs to be open in design mode to work.

How can i set it up so the property can be changed without the report being open? Even better, can I do it on the fly in preview mode? Switching to True seems to work but not back to false here.

Many thanks,

GE
 
There's a report forum here (forum703), where such is perhaps more appropriate to address ...

instead of pushing this info (where the report probably need to be in design view), why not pull it? For instance use the on open event of the report or the on format event of the detail section, refer to for instance a checkbox on the form (or a puplic variable...) - here some "air code" demonstrating both approaches ...

[tt]'report open
me.section(acdetail).visible = forms("frmMyForm").contols("chkMyCheck").value

'detail on format
cancel = not forms("frmMyForm").contols("chkMyCheck").value[/tt]

Roy-Vidar
 
How are ya GoatieEddie . . . . .

In the Declaration Section of a module in the modules window, declare a boolean public variable:
Code:
[blue]Public rptDetail As Boolean[/blue]
Next, in the Open event of the report:
Code:
[blue]   Me.Detail.Visible = rptDetail[/blue]
Finally, set the variable before opening the report:
Code:
[blue]   rptDetail = False
   DoCmd.OpenReport "ReportName"[/blue]

Calvin.gif
See Ya! . . . . . .
 
All sounds good and I understand what you are suggesting (pleasant change!) but when I put in the me.detail bit, it bombs out saying it can't find the macro me! I have tried all sorts of permutations and I am now very frustrated!
 
Use the intellisence within the reports on open event - note - TheAceMan1's notations/syntax uses the name of the section (which might be what is bombing here), which can be localized (where I reside, it defaults to Detalj), or altered by the developer. Me.Section(acDetail), as I used in my suggestion, should work regardless of locale and name of the section (but do note my typo, contols in stead of controls)...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top