By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Crosstab report with dynamic column headings

P: n/a
I have copied code from the MS Knowledge Base that produces the above
report. I understand the code and am pretty comfortable working with
recordsets. I used the same report structure successfully with Access2
some years ago.

The only real changes I have made to the sample were made to accommodate
a larger number of columns and to display a blank string instead of 0
(having saved the value for totals).

BUT there is clearly something wrong

My code loops through the OnFormat event without proceeding to the
OnPrint event until the last record. This produces an odd result
because the report prints the last record a number of times equal to the
number of records it should print. ie. a report from a query that
produces 531 lines of information has the last record printed 531 times.

I am guessing there is something I dont know that is more likely to be
related to the underlying structure of the report rather than the lines
of code.

Any clues gratefully received.
gus

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Gus:

It is hard to know exactly what might be causing the issue without seeing
the code (yes I am familiar with dynamic crosstabs and have created them
based on the KB article).

That being said, one potential cause of your issue would be in the
ReportHeader_Format event. The following line of code in that event, if not
present, can cause the symptoms you are experiencing.

rstReport.MoveFirst

The following subroutine is from the MS KB article at
http://support.microsoft.com/default...b;en-us;328320.

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)

' Move to first record in recordset at the beginning of the report
' or when the report is restarted. (A report is restarted when
' you print a report from Print Preview window, or when you return
' to a previous page while previewing.)
rstReport.MoveFirst

'Initialize variables.
InitVars

End Sub

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"gus kernot" <gu*@opr.com.au> wrote in message
news:54*****************@news.uswest.net...
I have copied code from the MS Knowledge Base that produces the above
report. I understand the code and am pretty comfortable working with
recordsets. I used the same report structure successfully with Access2
some years ago.

The only real changes I have made to the sample were made to accommodate
a larger number of columns and to display a blank string instead of 0
(having saved the value for totals).

BUT there is clearly something wrong

My code loops through the OnFormat event without proceeding to the
OnPrint event until the last record. This produces an odd result
because the report prints the last record a number of times equal to the
number of records it should print. ie. a report from a query that
produces 531 lines of information has the last record printed 531 times.

I am guessing there is something I dont know that is more likely to be
related to the underlying structure of the report rather than the lines
of code.

Any clues gratefully received.
gus

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.