Printing order!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My document is 3 pages long, What I would to do is when I print, I want to
print the following order 3rd page,2nd page and 1st page.... Anyway of doing
this in access?
 
I am reffering to a report in access.

I do have a button on my form that opens the report.
 
There's a PrintOut method that lets you specify page numbers when you print.

You should be able to do something like:

Dim strReport As String

strReport = "MyReport"

DoCmd.OpenReport strReport, acViewPreview
For intPage = Application.Reports(strReport).Pages To 1 Step -1
DoCmd.PrintOut acPages, intPage, intPage
Next intPage
DoCmd.Close acReport, strReport
 
Doug, I am lost and this might sound silly, Where should i put that code
again. I did not see the on PrintOut I can see on print feature on the page
and report but not printout....
 
That code should go into the Click event for the button you're currently
using to open the report.

Presumably all you've got now is the DoCmd.OpenReport statement: that code
would replace it.
 
Doug, Thanks that worked partially, however I have a question. Inorder to
open that report, a criterial has to be met, I have to enter a begining and
ending date, and select a customer criteria from a listbox. With the code
you provided, it will print all the records in my database instead of only
those I selected in the criteria...

Also I was not sure if I should put the code you gave me after the end iF
statement for for to work for alll the criteria...

This is how my Preview button code looks like... (Same code is in my print
button but with acnormal instead of acpreview)

Private Sub Preview_Click()
Dim strDocName As String
Dim intPage As Integer

strDocName = "rptInvoice"

If Me.CustType.Column(0) = "<All Customers >" Then
DoCmd.OpenReport strDocName, acViewPreview

ElseIf Me.CustType.Column(0) = "<Mid West Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[PrintBTime] is
null And [LoanType] ='" & "MWC" & "'"
ElseIf Me.CustType.Column(0) = "<Central Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[printBTime]is
null And [LoanType]='" & "CC" & "'"

For intPage = Application.Reports(strDocName).Pages To 1 Step -1
DoCmd.PrintOut acPages, intPage, intPage
Next intPage
DoCmd.Close acReport, strDocName
End if
 
Given what you've got, you definitely want it after the End If. If not,
it'll only work for Central Customers. However, you probably want to put
some logic in to avoid a case where CustType.Column(0) isn't one of "<All
Customers >", "<Mid West Customers>" or "<Central Customers>"


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


JOM said:
Doug, Thanks that worked partially, however I have a question. Inorder to
open that report, a criterial has to be met, I have to enter a begining
and
ending date, and select a customer criteria from a listbox. With the code
you provided, it will print all the records in my database instead of only
those I selected in the criteria...

Also I was not sure if I should put the code you gave me after the end iF
statement for for to work for alll the criteria...

This is how my Preview button code looks like... (Same code is in my print
button but with acnormal instead of acpreview)

Private Sub Preview_Click()
Dim strDocName As String
Dim intPage As Integer

strDocName = "rptInvoice"

If Me.CustType.Column(0) = "<All Customers >" Then
DoCmd.OpenReport strDocName, acViewPreview

ElseIf Me.CustType.Column(0) = "<Mid West Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[PrintBTime] is
null And [LoanType] ='" & "MWC" & "'"
ElseIf Me.CustType.Column(0) = "<Central Customers>" Then
DoCmd.OpenReport strDocName, acViewPreview, , "[printBTime]is
null And [LoanType]='" & "CC" & "'"

For intPage = Application.Reports(strDocName).Pages To 1 Step -1
DoCmd.PrintOut acPages, intPage, intPage
Next intPage
DoCmd.Close acReport, strDocName
End if







Douglas J. Steele said:
Sorry, forgot to declare it, didn't I?

Dim intPage As Integer
 

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

Back
Top