count printed reports

  • Thread starter JACK GUNAWAN via AccessMonster.com
  • Start date
J

JACK GUNAWAN via AccessMonster.com

HI, AL, sorry for the very late reply, I have tried : But to no avail. The
event does not work maybe there is some mistake with the event code?

In addition, I am trying to use this to count the number of time report being
printed for the same report (according to sales order) and every report has
different number of times being printed. Can i also use the number of times
being printed to display on the report as to how many times being printed.
Thanks so much for the kind assistance. desperate.




Jack

I can not figure out how to know the number of times the report has been
printed whenever somebody print the same report.
In addition, how do I get the subreport on a report to display the same
product list (both in the subreport and report) while the list extends to 5
pages. Whenever I get to second page, the subreport still displays the first
page product list. Thanks. Please Help.

Jack

Reply to this message
Al Camp - 02-13-2006 18:08
Jack,
Not sure about "elegance" but this works...
Let's say you have a report called rptTest.
Create a table called PrintCount with 2 fields, ReportName/Text/NopDupes
and PrintCount/Num/Integer
Populate the table with this data...
ReportName PrintCount
rptTest 0

Use the report Open event to run this code...

Private Sub Report_Open(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblPrintCount SET tblPrintCount.PrintCount =
NZ([PrintCount])+1 " & _
"WHERE (((tblPrintCount.ReportName)='rptTest'));"
DoCmd.SetWarnings True
End Sub

Be aware, that PrintPreview also constitutes a "print" and increments
the counter. If you have the report "hardwired" to always print directly to
a printer (with no PrintPreview), then this should work pretty well.

Reply to this messageMessage Tree
JACK GUNAWAN - 03-15-2006 10:20
 
A

Al Camp

Jack,
Well, I tested my code before I sent it to you, and it works, so you may
have made a mistake in implementing it.

I see one typo I made... I said "create a table called PrintCount"...
that should have read "tblPrintCount"

Private Sub Report_Open(Cancel As Integer)
DoCmd.SetWarnings False
' (This next line of code in the Open event of the report must be all on
one line...)
DoCmd.RunSQL "UPDATE tblPrintCount SET tblPrintCount.PrintCount =
NZ([PrintCount]) +1 WHERE (((tblPrintCount.ReportName)='rptTest'));"

DoCmd.SetWarnings True
End Sub

If that still doesn't work, you'll need to describe the tblPrintCount you
created... in detail, and show some sample entries.
Also, cut and paste your report Open code for me to see.

And please don't create a "new" post to reply... just add it onto this
thread.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


JACK GUNAWAN via AccessMonster.com said:
HI, AL, sorry for the very late reply, I have tried : But to no avail.
The
event does not work maybe there is some mistake with the event code?

In addition, I am trying to use this to count the number of time report
being
printed for the same report (according to sales order) and every report
has
different number of times being printed. Can i also use the number of
times
being printed to display on the report as to how many times being printed.
Thanks so much for the kind assistance. desperate.




Jack

I can not figure out how to know the number of times the report has been
printed whenever somebody print the same report.
In addition, how do I get the subreport on a report to display the same
product list (both in the subreport and report) while the list extends to
5
pages. Whenever I get to second page, the subreport still displays the
first
page product list. Thanks. Please Help.

Jack

Reply to this message
Al Camp - 02-13-2006 18:08
Jack,
Not sure about "elegance" but this works...
Let's say you have a report called rptTest.
Create a table called PrintCount with 2 fields, ReportName/Text/NopDupes
and PrintCount/Num/Integer
Populate the table with this data...
ReportName PrintCount
rptTest 0

Use the report Open event to run this code...

Private Sub Report_Open(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblPrintCount SET tblPrintCount.PrintCount =
NZ([PrintCount])+1 " & _
"WHERE (((tblPrintCount.ReportName)='rptTest'));"
DoCmd.SetWarnings True
End Sub

Be aware, that PrintPreview also constitutes a "print" and increments
the counter. If you have the report "hardwired" to always print directly
to
a printer (with no PrintPreview), then this should work pretty well.

Reply to this messageMessage Tree
JACK GUNAWAN - 03-15-2006 10:20
 
J

JACK GUNAWAN via AccessMonster.com

Al said:
Jack,
Well, I tested my code before I sent it to you, and it works, so you may
have made a mistake in implementing it.

I see one typo I made... I said "create a table called PrintCount"...
that should have read "tblPrintCount"

Thanks, i will try. I thought that it's been some time ago and I thought
that you have forgoten. Thanks.



Jack
 
J

JACK GUNAWAN via AccessMonster.com

Thanks, i will try. I thought that it's been some time ago and I thought
that you have forgoten. Thanks.

Jack

Hi, it works!! Thanks a lot! However,I still have this problem. I am
printing from a form which makes the report to be printed. However, every
sales form has different sales orders id and items and so is the report being
printed.
How to make the code you gave me work for every form(which contain different
sales items) so that for every sales order form which is printed can be
counted according to order ID. Thanks so much.


Jack
 
J

JACK GUNAWAN via AccessMonster.com

HI, I tried the code you gave, but works pretty slow on pentium 4. Can it be
made faster? I think AL has forgoten the posting i sent. Please help, thanks
AL.


Jack
 
A

Al Camp

Jack,
I really have to question why you are doing this. What difference would it make if an
OrderID were printed once or 20 times?

Try adding a field to your Order table called PrintCount, and each time that particular
report prints against that OrderID, increment it's PrintCount field by 1.
Use the same logic on your report as when you updated the seprate table you created,
but... call out the tblOrders, AND the OrderID being reported on.
 
A

Al Camp

Jack,
You wrote...
Hi, it works!! Thanks a lot! However,I still have this problem. I am
printing from a form which makes the report to be printed. However, every
sales form has different sales orders id and items and so is the report being
printed.

I responded with a solution, (see 3/31 @ 1:34) so let's stay with this problem...
Once we get each Order record to display how many times it has printed, we can move on to
the "slow response" problem.

*Now let me restate my solution. This will be easier to implement, and may also cure
the speed problem.

Your previous posts indicates to me that the Order form that you are printing is
"open" during the report print.
If that's true... and it should be... then...
1. Add a new field to your main Orders table called PrintCount (Numeric -
Integer - Default = 0)
2. Place that field on your main Order form. (ex. name = frmOrders) and name it
PrintCount
3. On the OnClose event of your report run this code...
Forms!frmOrders!PrintCount = NZ(Forms!frmOrders!PrintCount) + 1
4. Every time the report prints, it will directly update the value of that
specific OrderID record by 1.

Try that, and post back... If you have problems, please include all details, and your
code.
 
J

JACK GUNAWAN via AccessMonster.com

Al said:
Jack,
I really have to question why you are doing this. What difference would it make if an
OrderID were printed once or 20 times?

Thanks for the assistance AL, I am trying to trace the number of times being
printed for the pos system so that I would know the employee would not print
the invoice twice or more so as to reduce shrinkage. The different storage
employee would provide the goods as is in the invoice being printed even
though the invoice is printed number of times, they thought is for different
customer but actualy only the same customer. I am afraid that the second or
more times the goods being provided by storage would be 'sold' by the
customer service employee using the pos. Thanks again.

Jack
 

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

Top