Report Copies and Custom Footers

PMF1957

Registered User.
Local time
Yesterday, 19:35
Joined
Dec 21, 2012
Messages
23
Hey all,

I could use a little help (maybe a lot of help). I'm a novice (more rookie) in access, but I have created several straight forward system so I have some idea of how this stuff works....

This is what I'm trying to do.
I have an old access database (written with 2003 but running under 2010) that creates workorders and I need to change a couple of the reports to print three copies with each copy having different text in the footer. I'm converting the reports from a old DOT Metrix special form printer to a laser printer. I have already modified the reports as far as the titleing and cosmetics are concerned and they print and look great on the laser printer. I havealso added a TxT box that I want to contain the information on the report.
The reports are generated in a couple of different ways off different screens in the system off buttons, but I figured if I can get one of them to work I can replicate it to the others.
I have gone through the reports forum and have found a couple of solutions but can't get them to work. This is what I have found:

On the on buttion to print a range of workorders (it drives a query that asks for a starting workorder number and a ending workorder number) click from the from the switchboard:

DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "1"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "2"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "3"

Then I have this code but I'm not sure where it goes. On the report in the "on open" expression? not sure..

Select Case Me.OpenArgs
Case "1"
txtBox62 = "Shop Copy"
txtFld1 = [qryField1]
etc
Case "2"
txtBox62 = "AFS Copy"
txtFld1 = [qryField2]
etc
Case "3"
txtBox62 = "XXXXX Copy"
txtFld1 = [qryField3]
etc
End Select

If anyone can help please do and let me know what else I may have to do to get this to work it would be great......

Thanks!
 
Is this what you're after?

Me.txtFld1.ControlSource = "qryField3"
 
pbaldy,

Thank you for the reply. Yes to your question but mainly if the code I specified is good my main question then becomes where do I place it, in what sequence or process does it go...
 
I would try the open event of the report. Basically the open event to set control sources and such, the load event to access values from the record source, which aren't yet available in the open event.
 
I added to the load:
Private Sub Report_Load()
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "1"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "2"
DoCmd.OpenReport "rptBulkWorkOrdersbyWorkOrderNumberRange", , , , , "3"
End Sub

Then added to the open:
Private Sub Report_Open(Cancel As Integer)
Select Case Me.OpenArgs
Case "1"
Text62 = "Shop Copy"
txtFld1 = [qryField1]
etc
Case "2"
Text62 = "AFS Copy"
txtFld1 = [qryField2]
etc
Case "3"
Text62 = "Extra Copy"
txtFld1 = [qryField3]
etc
End Select
End Sub

I get a compile error on txtFld1 - Variable not defined

Please advise.
 
I would expect the OpenReport lines to be behind a form button. You can't open the report from within itself. As to the error, what exactly are you trying to accomplish with that line?
 
The button is on the main Switch board. "Print WO's by WO range". It is used to reprint or print workorders in a supplied range. When clicked it drives a query asking for the starting then ending work order number. When those are supplied it prints/reprints the workorders in the range you specified. So I'm not really opening a form, just printing/reprinting workorders with a report on data already entered into the system. so I just need to print 3 copies of that report with 3 different footers.

I think I'm getting lost here....
 
Then take the OpenReport lines out of the load event, and describe exactly what you're trying to accomplish with the line that errors.
 
OK. I removed the OpenReport lines out of the load event.
What I want to do now is the following:
On the first copy of the report I want to print I need to put into the footer Text62 box "AFS Copy".
On the second copy I want to print i need to put into the footer Text62 box "Shop Copy".
On the thrid copy I want to print i need to put into the footer Text62 box "File Copy".
 
The other lines do that. You said this is the line throwing an error, so what is it supposed to be doing?

txtFld1 = [qryField1]
 
I thought it would move the desired text to the desired location.
 
I think what you want will be accomplished by these lines:

Text62 = "Shop Copy"

but it probably has to be in the load event. I mentioned the open event earlier because I thought you were trying to set control sources.
 
Pbaldy....Hope you had a good weekend.

I move the code to the load event. The report prints only one copy and nothinig in the footer.
 
The 3 OpenReport lines are behind a button on a form? I tested the load event and a line like

Me.Text62 = "Shop Copy"

populated a textbox with that text.
 
On this report I'm working on the process is as follows:
a button on the switchboard fires off a query generated report and asks for the starting work order number and the ending work order number, then prints the work orders in that range.
So I guess the answer to you question is no it is not from a button on a form.
This is the record source for the report:
SELECT tblWorkOrders.txtWorkOrderNumber, tblWorkOrders.txtStoreNumber, tblWorkOrders.dtmDueDate, tblWorkOrders.lkpStatus, tblWorkOrders.txtPONumber, tblWorkOrders.txtAccountNumber, tblWorkOrders.lkpRequestedBy, tblWorkOrders.dtmProcessDate, tblWorkOrders.sngQuantity, tblWorkOrders.lkpCatalogNumber, tblWorkOrders.memComments, tblFixtures.txtDescription FROM tblWorkOrders
 
OK resolved this with some additional research and with the great help of pbaldy, thank you very much. I will lay out my solution below:
From the form/buttion where the report is requested, on the ON CLICK [Event Procedure] i added the following:

DoCmd.OpenReport stDocName, acViewNormal, "Work Orders Filter", , , "Copy 1"
DoCmd.OpenReport stDocName, acViewNormal, "Work Orders Filter", , , "Copy 2"
DoCmd.OpenReport stDocName, acViewNormal, "Work Orders Filter", , , "Copy 3"
This is utilizing the OpenArgs of the DoCmd OpenReport statement.

Then on the report itself, in the page footer section I added a Unbound text box. This was called Text44.
Then in the page footers properties, in the On Print [Event Procedure] I added:
Me.Text44 = Me.OpenArgs

And magic, i get three copies of the same report with different footers.
 
Glad you got it sorted out.
 
Thanks for putting me in the right direction and your time....
 
No problem. Send some snow out this way and we'll call it square. :p
 

Users who are viewing this thread

Back
Top Bottom