Report not printing correct unless browsing each page

  • Thread starter Thread starter Daniel.Ran.XU
  • Start date Start date
D

Daniel.Ran.XU

Dear All,

I have a problem in Access Report. I have got a report with nearly 100
pages. If I display it and print it straight away, it is showing me
the wrong data. But If I display it and browsing each page, and then
print, it works fine. But how can I ask user to browse 100 pages
before each time they are print? Any help would be appreciated.

Cheers
Daniel
 
If you can't fix it any other way, then you might try adding a control
to your report with a control source set to
=Pages
that will force the report to calculate the number of pages and the only
way it can do that is to go all the way through the report to the end.

It sounds as if you may be doing calculations in the report's event that
changes the data based on more than the current record. This is usually
not a reliable method due to the way reports are generated.

If the above is true, you might want to post the code and explain what
you are attempting to do.

'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Thanks guys. I do have a lot of code in the report event. Let me try
to explain what I am doing.

I have a main report which has 4 sub reports. One of them is the total
of the other three. all these four reports are using CrossTab query to
show month and year across and some items on the left. In the detail
section, there are heaps of textboxes to show the data. In the code, I
am using queries which have the criteria of customer to grab data and
assign the data into every single textbox. In the datasource of the
report, there is just a simple query to have customer name which is
used to link with main report. I just paste part of the code in the
event to make it clear:

Private Sub Report_Open(Cancel As Integer)
.....
Set rstExpectedOrderJobs = CurrentDb.OpenRecordset("Select * from
qryBudgetExpectedOrderJobs_Joinery Where CompanyName='" &
StrCompanyName & "'")
.....
End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
....
For intX = 1 To intColumnCount
Me("txtExpectedOrderJobs" & intX) = rstExpectedOrderJobs(intX + 1)
NEXT intX
....

End Sub


I do not know I have explained it clear or not. Can you guys please
have a look and give me some suggestion? Thanks heaps.

Daniel
 
So this is a sub-report, and it is supposed to grab StrCompanyName
from the main report. How have you done that?

(david)
 
So this is a sub-report, and it is supposed to grab StrCompanyName
from the main report.  How have you done that?

(david)












- Show quoted text -

That's a text box in main report. I just get the value and use it in
the query. Thanks.
 
It appear that is the part which is not working.

You need to delay printing the subreport until after the main report has
queried, or re-run the print event after the main report has queried.

One way to do that would probably be to put the total number of pages
on each page, forcing the report to go through all through the report once
to get the number of pages, then a second time to write the total on each
page.

Another way would be to bind the sub report with a master/child field,
even if it is not used, so that the sub report re-queries after the main
report gets each page record.

(david)

So this is a sub-report, and it is supposed to grab StrCompanyName
from the main report. How have you done that?

(david)












- Show quoted text -

That's a text box in main report. I just get the value and use it in
the query. Thanks.
 
It appear that is the part which is not working.

You need to delay printing the subreport until after the main report has
queried, or re-run the print event after the main report has queried.

One way to do that would probably be to put the total number of pages
on each page, forcing the report to go through all through the report once
to get the number of pages, then a second time to write the total on each
page.

Another way would be to bind the sub report with a master/child field,
even if it is not used, so that the sub report re-queries after the main
report gets each page record.

(david)





That's a text box in main report. I just get the value and use it in
the query. Thanks.- Hide quoted text -

- Show quoted text -

Thanks David,

I do have master/child field linked. I don't understand what you mean
about put the total number of pages on each page? can you please
explain it a little more? Thanks again.

Daniel
 
It appear that is the part which is not working.

You need to delay printing the subreport until after the mainreporthas
queried, or re-run the print event after the mainreporthas queried.

One way to do that would probably be to put the total number of pages
on each page, forcing thereportto go through all through thereportonce
to get the number of pages, then a second time to write the total on each
page.

Another way would be to bind the subreportwith a master/child field,
even if it is not used, so that the subreportre-queries after the mainreportgets each page record.

(david)





That's a text box in mainreport. I just get the value and use it in
the query. Thanks.- Hide quoted text -

- Show quoted text -

Thanks David,

I do have master/child field linked. But what do you mean "Put the
total number of pages on each pate"? Can you please explain a little
bit more? I have got total pates field in the page footer section.
Thanks again.

Daniel
 
That's =Pages as the source for a text box, as John Spencer suggested.
If you've got that, and a master/child field then "it should be working" :~(

Do you display the value of StrCompanyName on the sub-report?
Does it display correctly? Also display the PrintCount value from
the detail section.

Just to be clear, the wrong values that you see are shown in the detail
section
of a subreport?

Do you know how to modify a cross-tab query to get fixed field names?
Can you do it that way?

(david)


It appear that is the part which is not working.

You need to delay printing the subreport until after the main report has
queried, or re-run the print event after the main report has queried.

One way to do that would probably be to put the total number of pages
on each page, forcing the report to go through all through the report once
to get the number of pages, then a second time to write the total on each
page.

Another way would be to bind the sub report with a master/child field,
even if it is not used, so that the sub report re-queries after the main
report gets each page record.

(david)





That's a text box in main report. I just get the value and use it in
the query. Thanks.- Hide quoted text -

- Show quoted text -

Thanks David,

I do have master/child field linked. I don't understand what you mean
about put the total number of pages on each page? can you please
explain it a little more? Thanks again.

Daniel
 
Back
Top