Link to home
Start Free TrialLog in
Avatar of jodstrr2
jodstrr2

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
I do not see where you assign a value to the variable WhichTransmital?