Microsoft Office Tutorials and References
In Depth Information
Creating a Dynamic Crosstab Report
Figure 96 – Dynamic CrossTab Report
The two buttons allow the user to choose from a Fixed (static) report and a
Dynamic report. The Fixed report only works when all fields are selected; the
Dynamic report always works. The reports are based on a query that is
working with a link to a table with the selection field filtered to be True, as
described in the Moving Rows in List Boxes example found on page 355 . The
basic code for making the report dynamic is straightforward and based on the
fact that the fields on the report are coded in VBA and that the .fields property
of the recordset can be processed to be enumerated.
Acs
Private Sub Report_Open(Cancel As Integer)¶
Dim intI As Integer¶
Dim rs As DAO.Recordset¶
' Set the recordset to the Recordsource of the report¶
Set rs = CurrentDb.OpenRecordset(Me.RecordSource)¶
' By default all fields are set to invisible¶
'Place headers¶
For intI = 2 To rs.Fields.Count - 1¶
' use fieldname for column heading,¶
' but skip the part with the sequence number¶
Me(lblCol & intI - 1).Caption = Mid(rs.Fields(intI).Name, 3)¶
Me(lblCol & intI - 1).Visible = True¶
Search JabSto ::




Custom Search