• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

Print problem

Hi Experts,
I'm having a print problem.  Here is my problem, I want the system to print one calendar at a time.  For example, I have calendar Q and Calendar S on the same criteria that I entered.  I want to Calendar Q print out 7 pages then Calendar S print out 7 pages instead first page is Calendar Q and 2nd page is Calendars then 3rd page is Calendar Q and 4th page is Calendar S etc.  

Below is my coding and the coding only print the first record which means only print 7 page of the Calendar Q and did not print the Calendar S.  Any help will be appreciate.

Private Sub Continue_Click()
On Error GoTo Err_Continue_Click

    Dim stDocName As String
    Dim stCriteria As String
     
     Form_frmWhichTransmittal.BatchID = Me.BatchID
     Form_frmWhichTransmittal.COURTDATE = Me.COURTDATE
     Form_frmWhichTransmittal.FiledDate = Me.FiledDate
     
     Cal = DLookup("Calendar", "qryAliasSummons/SummonsTransmittal")
     COURTDATE = DLookup("PDAPPEAR", "qryAliasSummons/SummonsTransmittal")
     
    Select Case WhichTransmittal
    Case 1
        Form_frmPrintedReportsAll.LabelMessage = "TRANSMITTAL FOR ALIAS SUMMONS"
    Case 2
        Form_frmPrintedReportsAll.LabelMessage = "TRANSMITTAL FOR SUMMONS"
    End Select
 
    If IsNull(BatchID) Or IsNull(COURTDATE) Or IsNull(FiledDate) Then
       MsgBox "Please enter BatchID, Appearance Date and Date Filed before proceeding."
       Exit Sub
    Else
       If Form_frmPrintedReportsAll.LabelMessage = "TRANSMITTAL FOR ALIAS SUMMONS" Then
          stDocName = "rptAliasSummons/SummonsTransmittal"
          DoCmd.OpenReport stDocName, acPreview, , "CALENDAR = '" & Me.Cal & "' and PDAPPEAR = #" & Me.COURTDATE & "#"
          DoCmd.SelectObject acReport, stDocName, False
          DoCmd.PrintOut acPrintAll, , , , 7
          DoCmd.Close acReport, stDocName
       Else
          stDocName = "rptAliasSummons/SummonsTransmittal"
          DoCmd.OpenReport stDocName, acPreview, , "CALENDAR = '" & Me.Cal & "' and PDAPPEAR = #" & Me.COURTDATE & "#"
          DoCmd.SelectObject acReport, stDocName, False
          DoCmd.PrintOut acPrintAll, , , , 8
          DoCmd.Close acReport, stDocName
       End If
    End If
     
   

Exit_Continue_Click:
DoCmd.Close acForm, "frmWhichTransmittal"
    Exit Sub

Err_Continue_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_Continue_Click
   
End Sub
0
jodstrr2
Asked:
jodstrr2
1 Solution
 
Jeffrey CoachmanCommented:
First can you explain the details of this "Calendar" you are using?
My guess ias that this this is a "Report"

Also when I do things like this, I actually Open the report Hidden, not just select it.

Your code is hard to decipher without any "Context".

< I want to Calendar Q print out 7 pages >
To be clear, Your code specifies 7 *Copies* of *All* the pages of the first report, not really 7 *Pages*

But in the most basic sense, in order to print Seven *Pages* of one Report then 7 pages of another Report, use code like this:

DoCmd.OpenReport "Report1", acViewPreview, , , acHidden
DoCmd.PrintOut acPages, 1, 7
DoCmd.Close acReport, "Report1"

DoCmd.OpenReport "Report2", acViewPreview, , , acHidden
DoCmd.PrintOut acPages, 1, 7
DoCmd.Close acReport, "Report2"

JeffCoachman
0
 
donaldmaloneyCommented:
When you select the criteria and then open the "Report"
you expect ONE calendar to print.

However the "Report" recordsource may be drawing all the data and have a sort by month or other field and not a "Calendar type" so the report will print in month order C S C S C S.
Check your report recordsource query and see how the query is set up.

Without actually having a sample MDB it would be difficult to be totally correct.

Don
0
 
Dale FyeCommented:
Actually, if this is being done in a report, the sort order and grouping of the query have little to do with it.  The Sorting and Grouping setup in the report control the grouping and ordering (if there are any).  So you might want to open the report in design view, select the Group & Sort button on the Design Ribbon (2007) and setup groups and sorting, as appropriate.
0
 
GRayLCommented:
I do not see where you assign a value to the variable WhichTransmital?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now