Gustav Brock
gustav at cactus.dk
Tue May 6 09:46:53 CDT 2003
Hi Joe Wouldn't it be the controls and not the subforms to hide: > Me.tblBarrel_subreport.Visible = True > Me.tblSandBlast_subreport.Visible = False > Me.tblSweco_subreport.Visible = False /gustav > 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