X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Sorting Printing Queue By Nesting Loops, Access 2013    
post Dec 12 2017, 06:22 AM

Posts: 116
Joined: 13-August 13


I was hoping someone would be able to help me with this.

I have a set of files on hard drive and want to mix them in print queue with an access report. So access report page act like a header page for the files that are on the hard drive.

1 page from rptGroupTestTutor, then all files relevant to that tutor in the hard rive (we have a list of relevant files in the tblinfo, linked by string identifier field tusername)

The code below prints out the right order in debug.print, but the files in the printer come out as all access report, then all files form the hard drive. What can I do to mix them?

Thank you!

Private Sub cmdPrintGroupTest_Click()

Dim rstGroupTests As DAO.Recordset
Dim rstTutors As DAO.Recordset
Dim db As DAO.Database
Dim sFilePath As String
Dim sStudentUser As String
Dim sTutorUser As String
Dim sTutor As String
Dim sqlWhere As String
Dim lGroup As Long

Dim rptGroupTestTutor As Report

Set db = CurrentDb

Set rstTutors = db.OpenRecordset( _
            "SELECT DISTINCT tblInfo.tutor, tblInfo.tusername " & _
            "FROM tblInfo")

    With rstTutors
            Do Until rstTutors.EOF
            sTutor = .Fields(1)
            Debug.Print "New  tutor page: "; sTutor
            sqlWhere = "tusername = '" & sTutor & "'"
            DoCmd.OpenReport "rptGroupTestTutor", acViewPreview, , sqlWhere
            DoCmd.PrintOut acPrintAll
            DoCmd.Close acReport, "rptGroupTestTutor"
            Set rstGroupTests = db.OpenRecordset( _
                "SELECT * " & _
                "FROM tblInfo " & _
                "WHERE tusername = '" & sTutor & "' ")
                With rstGroupTests
                        Do Until rstGroupTests.EOF
                        sTutorUser = .Fields(3)
                        Debug.Print "Tutor User: "; sTutorUser
                        sStudentUser = .Fields(1)
                        Debug.Print "Student: "; sStudentUser
                        lGroup = .Fields(4)
                        Debug.Print "Group number: "; lGroup
                        sFilePath = "C:\" & lGroup & ".pdf"
                        Debug.Print sFilePath
                        CreateObject("Shell.Application").Namespace(0).ParseName(sFilePath).InvokeVerb ("Print")
                End With
    End With

Set rstGroupTests = Nothing
Set rstTutors = Nothing
Set db = Nothing

End Sub

This post has been edited by CaptainMilly: Dec 12 2017, 06:23 AM
Go to the top of the page
post Jan 6 2018, 02:43 AM

UtterAccess VIP
Posts: 18,999
Joined: 29-September 03
From: Oklahoma City, Oklahoma

Where you able to get this resolved?

If not, I will be glad to help.

Boyd Trimmell aka Hi Tech Coach ( HiTechCoach.com free Access stuff)
Microsoft MVP 2010-2015 - Access Expert
Inventory Control, Accounting, BPM, and CRM Software Developer
"If technology doesn't work for people, then it doesn't work."
Go to the top of the page
post Jan 22 2018, 10:01 AM

Posts: 116
Joined: 13-August 13

I wasn't able to get this sorted. When I stop all printing and wait for the print queue to get generated the Access files get sent first and then the hard drive files. We ended up sorting them into piles after the print, because the two piles are still in required order, just not slotted.

It would be great if you could help.

Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    21st July 2018 - 10:00 AM