Different text based on copynumber on report?

J

Jen

Hello.

I have a combobox on a form from where users can choose to print copies of a
report (how many copies, 0-4). Works ok, code for the commandbutton for
printing the report(s) is further below.
My question is how can I print a different text in a textbox or label in the
reports footer based on which copy it is.
For instance, first copy nothing, second copy "Own copy", third copy
"accounting" and so on? If the amount of copies would be always the same I
guess I could do this but now as the user get's to select the amount of
copies I don't know how to do it. Jen.



Private Sub utskrift_Click()
On Error GoTo Err_utskrift_Click

Dim stDocName As String

stDocName = "Faktura"
DoCmd.OpenReport stDocName, acPreview, "",
"[fakturanr]=[Forms]![fakturainmatning]![fakturanr]"

DoCmd.PrintOut , , , , Me!kopiaval, -1
DoCmd.Close acReport, stDocName, acSaveNo
Exit_utskrift_Click:
Exit Sub

Err_utskrift_Click:
MsgBox err.Description
Resume Exit_utskrift_Click

End Sub
 
J

JohnFol

Depends on which version you are running.

For AccXP there is a
Docmd.Openreport. .. .. . . ..OpenArgs
On your CLickEvent you would do

For n = 1 to ComboBoxPrintCopies

Select Case n
Case 1
Docmd.Openreport. .. .. . . .."Own"
Case 2
Docmd.Openreport. .. .. . . .."Accounting"
:
Next n

Then on the report section you can get the value back by using me.OpenArgs

ie Me.WhosCopy = me.OpenArgs


If you are not using XP, I have a few other ideas . . .
 
J

Jen

I have Access XP but the file format I do this thing in is 2000, and this
should run on Access 2000 too. Jen.

JohnFol said:
Depends on which version you are running.

For AccXP there is a
Docmd.Openreport. .. .. . . ..OpenArgs
On your CLickEvent you would do

For n = 1 to ComboBoxPrintCopies

Select Case n
Case 1
Docmd.Openreport. .. .. . . .."Own"
Case 2
Docmd.Openreport. .. .. . . .."Accounting"
:
Next n

Then on the report section you can get the value back by using me.OpenArgs

ie Me.WhosCopy = me.OpenArgs


If you are not using XP, I have a few other ideas . . .


Jen said:
Hello.

I have a combobox on a form from where users can choose to print copies
of
a
report (how many copies, 0-4). Works ok, code for the commandbutton for
printing the report(s) is further below.
My question is how can I print a different text in a textbox or label in the
reports footer based on which copy it is.
For instance, first copy nothing, second copy "Own copy", third copy
"accounting" and so on? If the amount of copies would be always the same I
guess I could do this but now as the user get's to select the amount of
copies I don't know how to do it. Jen.



Private Sub utskrift_Click()
On Error GoTo Err_utskrift_Click

Dim stDocName As String

stDocName = "Faktura"
DoCmd.OpenReport stDocName, acPreview, "",
"[fakturanr]=[Forms]![fakturainmatning]![fakturanr]"

DoCmd.PrintOut , , , , Me!kopiaval, -1
DoCmd.Close acReport, stDocName, acSaveNo
Exit_utskrift_Click:
Exit Sub

Err_utskrift_Click:
MsgBox err.Description
Resume Exit_utskrift_Click

End Sub
 

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