[AccessD] 3 subreports in detail section - show only one?

John Ruff papparuff at attbi.com
Tue May 6 09:47:14 CDT 2003


This should work:

tblBarrel_subreport.Visible = False
tblSandBlast_subreport.Visible = False
tblSweco_subreport.Visible = False

Select Case Me.[Machine]
    Case 1, 2, 5, 6, 7, 8
        tblBarrel_subreport.Visible = True
    Case 3, 4
        tblSweco_subreport.Visible = True
    Case 9, 10, 11, 12, 13
        tblSandBlast_subreport.Visible = True
    Case Else
        MsgBox "Machine not recognized!"
        DoCmd.Close acReport, Me.Name
End Select


John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities

Home: 253.588.2139
Cell: 253.307/2947
9306 Farwest Dr SW
Lakewood, WA 98498

"Commit to the Lord whatever you do,
                and your plans will succeed." Proverbs 16:3



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Rojas
Sent: Tuesday, May 06, 2003 7:24 AM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] 3 subreports in detail section - show only one?


Hello All,

(Access 2000)

I have a report that has 3 subreports in it detail section. Each record in
the data source of my report only links up to one of the subreports. The
subreport that it links up to varies from record to record. I know which
subreport it is linked up to via a field in my main report data source
called 'machine'.

Is it possible to hide 2 of the 3 subreports and show the 3rd for each
detail section? Meaning that on a given report that has 3 records in the
main report would have a detail section showing: subreport1 for record1 and
hide subreport2 and subreport3, show subreport3 for record2 and hide
subreport1 and subreport2, ...? (there could be any combination here)

I tried putting this code into the detail_format section:

Select Case Me.[Machine]
    Case 1, 2, 5, 6, 7, 8
        Me.tblBarrel_subreport.Form.Visible = True
        Me.tblSandBlast_subreport.Form.Visible = False
        Me.tblSweco_subreport.Form.Visible = False
    Case 3, 4
        Me.tblBarrel_subreport.Form.Visible = False
        Me.tblSandBlast_subreport.Form.Visible = False
        Me.tblSweco_subreport.Form.Visible = True
    Case 9, 10, 11, 12, 13
        Me.tblBarrel_subreport.Form.Visible = False
        Me.tblSandBlast_subreport.Form.Visible = True
        Me.tblSweco_subreport.Form.Visible = False
    Case Else
        MsgBox "Machine not recognized!"
        DoCmd.Close acReport, Me.Name
End Select


As I traced through the code the report displays a blank preview as soon as
it hits the first *.Visible line and the causes Access to crash.

Thanks!

Joe Rojas
jrojas at tnco-inc.com





This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please notify
the sender as soon as possible and destroy this message. While TNCO, Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability for
any damage caused by any virus transmitted by this email.
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list