Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

print number on report every time report is printed

Status
Not open for further replies.

pdtit

Technical User
Nov 4, 2001
206
BE
Hello,

What I'm looking for is the following :

The ever first time a report is printed (during initial use of the application) it should display a number "1".

Then, every time the report is printed, this number should be increased by 1.

Thus, if the report is printed 20 times, the number should be 20.

It sounds simple, but I'm stuck...

I've tried with the PageHeader OnPrint function

Regards,

Peter
 
Are you trying to implement a Copy N type of process? Similar to the multipart forms of 'olden days". e.g. 1 ~ Original; 2 ~ customer copy; 3 ~ file copy; ...

So you would print multiple copies of the SAME instantiation of the report?

Or are you looking for an 'instance' counter of the use of the report within the app. Similar to a charge on the basis of the use of the equipment (appllication / report)? Where the number would increment over a period of time.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Michael,

In fact, I was looking for the second option.

However, the first one seems interesting as well...
(I'm thinking of printing each report twice, and is it thus possible to print the word "copy" only on the second print-out in a special font ??)

I'm curious you know.

Regards,

Peter
 
Hmmmmmmmmmm,

for the "first":

an "independent" module. The declaration -at least- needs to be seperate fron the rest. The function COULD go in a report, but I like to keep the declaration and calculation together. It COULD get weird if there were multiplie users using the same routine for seperate reports at the same time?


Code:
Option Compare Database
    Dim CopyCount As Integer
Public Function basCopyCount() As String

    'Michael Red 10/17/2001
    'To "Mimic" the multi-part form where each 'copy'
    'is on a different color of paper.

    If (CopyCount > 3) Then
        CopyCount = 1
    End If

    Select Case CopyCount

        Case Is = 1
            basCopyCount = "Original"

        Case Is = 2
            basCopyCount = "Yellow Copy"

        Case Is = 3
            basCopyCount = "Blue Copy"

    End Select

    CopyCount = CopyCount + 1

End Function

As you may be able to discern, this returns a "string" re the "Copy", and incerments the "Copy" counter. The actual assignment of the string to something on the report is done in the report iteslf.

In this example, the process just 'mimics' the multipart form for the different colors of the various copies, so it should just 'cycle' through the "colors". Here, the report needs to be opened in code, al-la"

docmd.OpenReport "rptTournament", acNormal,, CopyCount = 3

which SHOULD print three copies of the report. As noted in the module, it has been a while since I did this one, and the time has 'rotted' the code which I used to demo the process, so the above sample command may be a bit simplistic!

For the second ver which you were really after, the mechanics are more than I am interested in throwing out 'pro bono', but the approach I would take would require at least the creation and manipulation of registry settings, and -if you are serious about the 'charge' for each use, it would also need some fairly robust security. However oncce past these hurdles, the basic approach is to just increment a counter for each instantation of the 'chargeable' objects. Going really out there, you could even have seperate counters for different "groups" of objects, thus charge more for some than others (presumably based on the complexity or development investment).



MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Michae

While searching for a similar solution, I came across this. Could you please clarify if I add this code to a new module, and the open report command to command button, this would work. Do I need a unbound text box to show the 'copy' name? If so, would this be known as basCopyCount. will appreciate if you could help if you could indicate steps that I need to take.
Cheers

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top