DB Documentation Report Crashes



Thanks for reading - I'm working on documenting a database and have a
report based on three tables - Objects, Fields, and Relationships.
Objects is the record source for the parent report, and the contents
of the Fields and Relationships tables are displayed as subreports.
In the OnFormat event of the main report's detail section, I change
the heights of the subreports to zero and resize the detail section
depending on the object type (no relationships for queries, no fields
or relationships for forms, reports, and modules).

This works more or less like it should, except that in print preview
the labels for the subreports don't show up when they should. But
when I close the print preview Access crashes with the generic
"encountered a problem and needs to close" dialog. If I remove the
module from the report it works fine (but obviously doesn't look like
I want it to).

I read up on this problem and all I could find was some information
about borders on controls causing glitches, but I have all the borders
in the report set to transparent. I tried moving this code to the
group header OnFormat event (I'm grouping on object type) and got the
exact same behavior.

I would prefer not to use CanShrink for the Subreports because the
associated labels still display and the detail section doesn't shrink
enough to look right. Here's the code in the report module:

Option Compare Database
Option Explicit

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As

Select Case Me.Report.ObjType
Case "Tables"
'Do Nothing
Case "Queries"
Me.RelationshipsSubreport.Height = 0
Me.RelationshipsSubreport_Label.Height = 0
Me.Detail.Height = Me.RelationshipsSubreport.Top
Case Else
Me.RelationshipsSubreport.Top = Me.FieldsSubreport.Top
Me.RelationshipsSubreport_Label.Top = Me.FieldsSubreport.Top
Me.FieldsSubreport.Height = 0
Me.RelationshipsSubreport.Height = 0
Me.FieldsSubreport_Label.Height = 0
Me.RelationshipsSubreport_Label.Height = 0
Me.Detail.Height = Me.FieldsSubreport.Top
End Select

End Sub

Thanks in advance for any help or advice!

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question