Dynamic cross-tab (and report)

User avatar
Gflanagan
Lounger
Posts: 40
Joined: 05 Nov 2014, 22:55

Re: Dynamic cross-tab (and report)

Post by Gflanagan »

Ok I took the line out and it's perfect :smile: it pops up with the message there is no next item. :thankyou: Have a wonderful weekend

User avatar
Gflanagan
Lounger
Posts: 40
Joined: 05 Nov 2014, 22:55

Re: Dynamic cross-tab (and report)

Post by Gflanagan »

Hi Hans,
A few years ago you helped me with a dynamic report. My organization has been using it for almost two years. They would like for the print out of the report to page break for each contact. I attached a snip of the query, report and pdf. Do I need to code this page break or can it be done within the report. Thank you in advance.

Gina Flanagan
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78523
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Dynamic cross-tab (and report)

Post by HansV »

Open the report in design view.
Insert a page break control in the Detail section, and set its Top property to 0.
Set the name of the page break control to PageBreak.
Create an On Format event procedure for the Detail section:

Code: Select all

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Static strContact As String
    Me.PageBreak.Visible = Me.Controls(Me.txtColumn1.ControlSource) <> strContact 
    strContact = Me.Controls(Me.txtColumn1.ControlSource)
End Sub
Here, txtColumn1 is the name of the leftmost text box in the Detail section.
Best wishes,
Hans

User avatar
Gflanagan
Lounger
Posts: 40
Joined: 05 Nov 2014, 22:55

Re: Dynamic cross-tab (and report)

Post by Gflanagan »

Run-time error '2465'
Microsoft Access can't find the field'=[contact] referred to in your expression.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78523
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Dynamic cross-tab (and report)

Post by HansV »

Try this instead:

Code: Select all

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Static strContact As String
    Me.PageBreak.Visible = (Me.txtColumn1 <> strContact)
    strContact = Me.txtColumn1
End Sub
Best wishes,
Hans

User avatar
Gflanagan
Lounger
Posts: 40
Joined: 05 Nov 2014, 22:55

Re: Dynamic cross-tab (and report)

Post by Gflanagan »

ok

User avatar
Gflanagan
Lounger
Posts: 40
Joined: 05 Nov 2014, 22:55

Re: Dynamic cross-tab (and report)

Post by Gflanagan »

Great!!! Thank you so much it worked!!! :clapping: