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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simulating Carbon Copies on Reports 1

Status
Not open for further replies.

MSealy

MIS
Sep 2, 2001
56
GB
I have several 1 page reports which need to be printed up to 3 times, but with each having a different line of text on them i.e "Yellow Copy" and "Pink Copy" etc. Is this possible?
In the past, I've had to duplicate the report into 2 pages and add the text on the bottom copy but this wastes memory, and can't be done for 3 copies because of the reports' maximum height setting.

Any one got any ideas?
Cheers.
 
Conceptually, I would try creating a Global variable "CopyCount". The report can reference the CopyCount. If (for instance you need 3 copies), the CopyCount = 4, You will know that the process is complete, so reset it to 1 and procede. In the report general code, just do a select case on copy count to get the textbox.caption to be whatever

as in

[tab]Select Case [CopyCoount]

[tab][tab]case = 1
[tab][tab][tab]textbox.caption = "Original"

[tab][tab]case = 2
[tab][tab][tab]textbox.caption = "Yellow Copy"

[tab][tab]case = 3
[tab][tab][tab]textbox.caption = "Blue Copy"

[tab]End Select

Then increment the CopyCount variable.

NOw, just "Run" the report with copies set to three.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Cheers for responding so quick :)

I tried using this code in a module called CopyCount, but when I typed it in, it changed the case = 1 to "Case Is = 1"
I'm not sure if this is the same thing.
On the OnOpen part of the report, I typed CopyCount = 4, but everytime I open the report, it highlights [CopyCount] as an "Invalid Outside Procedure".
Am I doing this right?
I'm also not sure how I set up my report to use this code - how does the report understand where on the page to place the textbox.caption text? (I'm a newbie to VB I'm afraid).

Many thanks,
 
I do not know why you are typing in the value for copycount - or in what specific circumstances. I 'assumed' that you would just "set" it in the module where it was defined. The textbox.text refers to a TEXTBOX control which you place on the report, so the strings are just placed into the textbox.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I'm getting there! Just Some difficulty with the Global Variable.
I've created an Unbound textbox on my report called "CopyControl". The detail part of the report (OnFormat property) contains

Select Case CopyCount()
Case Is = 1
CopyControl = "Original"
Case Is = 2
CopyControl = "Yellow Copy"
Case Is = 3
CopyControl = "Blue Copy"
End Select

I've created a module called "Mod1" with the following

Public Function CopyCount()
CopyCount = 4
End Function

My CopyControl texbox control source is

=CopyCount()

But this just returns "4" in the report. If I use a lower number then the debugger highlights the text line associated with that number.
Presumably, when it works it should show "Original" in the box, right?

I'm also not sure how to 'increment' the variable.

When you say to set the copies to three, is this also done in VB or just through the standard print setup on the menu?

Sorry, but I'm new(ish) to Access 2000 and have only recently started experimenting with VB.
 
The General/Public module:

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

    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
[code]

'_______________________________________________________
Below is the code in the Report itself.  The CONTROL "Me.TxtCopyCount" is the textbox control on the form where basCopyCount text is placed.  
[code]
Private Sub Report_Activate()
    Me.txtCopyCount = basCopyCount()
End Sub
Private Sub Report_Open(Cancel As Integer)
    CopyCount = 1
End Sub

'_____________________________________________________
I did not realize that you were a novice, and only posted the original as a 'concept' or 'idea' The first block of CODE represents your 'mod1', while the second block of code needs to be in the code behind forms (reports) for the specific report.

I am not sure why, but this works when the report is opened in print preview, but not if it is just sent to the printer.


So -at least for the moment- you can achieve the results by opening the report three seperate times in t he print preview mode - and then manually printing it.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
I've entered your code and changed the Name of the textbox on the report to "Me.TxtCopycount", but whenever the report is run, the debugger highlights "CopyCount = 1" in the "Private Sub Report_Open(Cancel As Integer)" report code.
I also tried to create a form, with my textbox duplicated, so I could enter the number of copies into that box and run the form from there. The same error occured.
Any idea what's going wrong?
 
Did you copy the code blocks or re-key them?

The error message which accompanies the "Stop" would also be helpful. I suspect that the variable is defined as PRIVATE to the module, or the name is mis-spelled. the code I pasted is copied directly from the module and (test)report I used to verify the process.

Also, make SURE that Copy Count is not defined (Dim, Static, Const, ... ) elsewhere in the application.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Excellent, it worked!!
Cheers :)

And I've added a Macro to open, print and close it and converted it to Visual Basic.

Thanks again.



 
RBO carbon aopies support
Please if somebody can answer how can I make to convert this kind of copies to .doc copies or text archivs copies.
When I operate PC Cillin in order to clean W97M.thus.g virus all the infective archives were converted in two archives: one .VIR and another copy .RBO.
Please if you can explain how can i do to convert in Word archives.
Tahks
Ernest Garin
camar@dd.com.ar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top