How do I print multiple reports to a directory at the same time

I'm trying to print a list of monthly reports to a directory by using the code below. The first part of the code runs a query to select Business Units that will receive the reports. The idea is to cycle through this list and print one report for each
Business Unit.  These vary from month to month. I create a record set from that query.  Where I'm getting stuck is in trying to pass the Business unit selected in the first query to the query that runs the final report. I end up getting multiple
reports with different titles but the content is the same, so I'm doing something incorrect.  Here is the code.  Any help would be greatly appreciated. QryNewMOR runs the report.
Private Sub Cmd012815_Click()
    Dim qdf As DAO.QueryDef
    Dim strSQL As String
    Dim strPathName As String
    Dim blRet As Boolean
    Dim rs As DAO.Recordset
    Dim stDocName As String
    Dim strSavedSQL As String
    Dim strBus As String
    Dim strExec As String
    If Me.Dirty Then Me.Dirty = False
    stDocName = "RptNewMOR"
    strSQL = "SELECT [Business Unit Long],[Responsible Executive] FROM tblRespExec WHERE (((tblRespExec.SelectedPrint)=True));"
    Set rs = CurrentDb.OpenRecordset(strSQL)
    If rs.RecordCount < 1 Then
        MsgBox "No Bus lines or Execs selected", vbCritical, "Error"
        Exit Sub
    End If
   'CreateFolder "C:\Test MOR"
    'store the current SQL
    Set qdf = CurrentDb.QueryDefs("QryNewMOR")
    strSavedSQL = qdf.SQL
    qdf.Close
    Set qdf = Nothing
Do
    strBus = rs![Business Unit Long]
    strExec = rs![Responsible Executive]
    Set qdf = CurrentDb.QueryDefs("QryNewMOR")
   strSQL = strSQL + Left(strSavedSQL, InStr(strSavedSQL, ";") - 1) & " and (qryNewMOR.[Draft Distribution List]=" & rs![Responsible Executive] & ");"
    strSQL = strSavedSQL
    qdf.SQL = strSQL
    Debug.Print strSQL
    qdf.Close
    Set qdf = Nothing
    strPathName = "C:\Test MOR\" & rs![Business Unit Long] & ".pdf"
    DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, strPathName
    rs.MoveNext
Loop Until rs.EOF
rs.Close
Set rs = Nothing
'restore the SQL
Set qdf = CurrentDb.QueryDefs("QryNewMOR")
qdf.SQL = strSavedSQL
qdf.Close
Set qdf = Nothing
End Sub
Dean J. Waring

I'm trying to figure out how to combine the two and am obviously not succeeding. Do you have a suggestion on how to make that work?
Hi Dean,
I am not completely sure of what you want. I suppose you want to modify the SQL definition of QryNewMOR, and use that modified query for the report?
In that case, and in the line of your program, I would make a QueryDef: QryStdMOR, with the "standard" strSavedSQL (so: strSavedSQL =  QryStdMOR), construct strSQL in the same way, and assign this to the SQL definition of QryNewMOR.
Thus, in your code at the very beginning, skip the line strSQL = strSavedSQL.
strSQL = Left(strSavedSQL, InStr(strSavedSQL, ";") - 1) & " and (qryNewMOR.[Draft Distribution List]=""" & rs![Responsible Executive] & """);"
' skip this line: strSQL = strSavedSQL
qdf.SQL = strSQL
Within the loop you should not start with strSQL = strSQL & ...., because strSQL will retain then its value from the previous loop, and increases and increases...
Finally, I have added some double doublequotes around rs![Resposible Executive], because string expressions must be enclosed by double doublequotes (or eventually a single singlequote).
Imb.
 strSQL = strSQL + Left(strSavedSQL, InStr(strSavedSQL, ";") - 1) & " and (qryNewMOR.[Draft Distribution List]=" & rs![Responsible Executive] & ");"
    strSQL = strSavedSQL
    qdf.SQL = strSQL

Similar Messages

  • Can anybody explain how to print multiple copies of different documents at the same time as at the moment I have to open each individually and press print

    Can anybody explain how to print multiple copies of different documents at the same time as at the moment I have to open each individually and press print

    is this a windows in bootcamp question ?

  • How to export 2 different report with a link at the same time

    Hi,
    Do anybody know how to export 2 different report with a link at the same time. I currently create a report which link to another report. But when I want to export the 1st report I also want the 2nd report also be exported.
    Thank you very much.
    Best Rgds,
    SL Voon

    Export all the three components individually.
    It will generate 3 script files. Now run them from SQL>
    null

  • How do you stop multiple Youtube videos from playing at the same time?

    As of a few days ago, when I click on a youtube video, as the commercial begins to play, you can begin to hear multiple/different commercials playing at the same time. After the commercials, the same issue occurs with the main video--multiple videos are being played at the same time and are not in sync. I've updated all my plug ins and have tried the suggestion posted in the forum provided in the link below in which someone else has expressed the same issue, but nothing has worked so far. Does anyone know what can be done?
    http://productforums.google.com/forum/#!topic/youtube/5Lnikma4UqM

    Are you loading those videos as Flash or HTML5? It is possible to prevent videos from playing until you click something with Flashblock for Flash or Stop Tube HTML5 for HTML5. You can also stop the commercials with Adblock Plus with an Easylist subscription.
    * https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/
    * https://addons.mozilla.org/en-US/firefox/addon/flashblock/
    * https://addons.mozilla.org/en-US/firefox/addon/stop-tube/

  • How do I view multiple images from different projects at the same time?

    Hello
    I've been trying to find the answer in the user manual, but no luck so far.
    I did find how to open 2 projects at once, but I can only see one image at a time in the viewer and I have to keep going back and forth between projects to compare images. (These are scans of old photos and I want to eliminate the ones that are poorer quality, so need to compare numerous images from 2 sets of scans)
    How can I view an image from one project at the same time as an image from another? I know that it can be done in the same project by apple-clicking the second, third etc image, but this doesn't work if the images are from different projects.
    Thank you
    Elizabeth

    Thank you again Tony
    I've now created an album, independent of the projects, and dragged test images into it and it does just the job I needed. Now i just need to keep my brain sorted with which ones are which while i'm working
    Elizabeth

  • How do i export multiple full resolution movie files at the same time in final cut pro 6?

    I've been using Final Cut Pro since version 3 came out, know the program well, have even had jobs consisting of just operating the program.  I'm currently running version 6 because that's the latest one that works on my computer.  Back in verison 3, there used to be an option under Export to export a "Final Cut Pro" movie, which was really a Quicktime movie but appeared with a FCP icon and defaulted to opening in FCP, but the important thing about it is that it was a full resolution copy of the movie with no compression.  Now, that option seems to have been changed to "export Quicktime movie."  In my opinion that change is kind of stupid since it is so much less specific and is even less of an implication that one is exporting a full resolution file.  But in fact you are.
    One also has the option of using Compressor to export a version of a movie, and therein there are so many different options that if you are not confused by it I think there's something wrong with you.  Moreover, it would appear that there is no equivalent of exporting a full resolution version of a file in Compressor.  Fair enough: a full-resolution file involves no compression so is not appropriate for "Compressor."  BUT, suppose you want to export multiple uncompressed, full-resolution movies at once.  When you use Compressor, you are able to create batch lists and export many things at the same time, for instance, lists that will take many hours to complete so you can go to bed and get the results the next day.  But as far as I can tell there is no way to do this at full resolution without compression.  Instead you have to sit at the computer waiting for each one to finish and after each one, manually go to the next and select "export Quicktime movie."  Even if there is a way to do this I would complain that such an obviously desireable thing is so unaccessable.  In fact, the only reason I've typed out my question at such length is because I'm stuck here waiting for each one of my movies to export.
    Anyway, all my complaints aside, anyone know how to do this?

    what you're missing to export multiple files is the batch export command available in the file menu or by control clicking on the items in the browser.  You can export multiple sequences/clips at full resolution with this.
    This has been available in fcp for a long long time.
    Wow, you are right.  Now that you mention it, I can't believe I never noticed that.  Thanks.
    Only if you have the 'Self-Contained' box checked.  Otherwise you'll end up with a reference movie.
    Correct.  That box is typically checked by default.  There are other default settings you could change that would not result in a full-quality version, but what I meant was hitting that option from the pull-down menu, then changing nothing and hitting ok.

  • How can i run multiple instances of Photoshop EXE at the same time on windows 7

    Alright. You may ask why do you need multiple ?
    Assume that i have 10000 PSD files in 10 different folders
    I have a script that just save as them as PNG
    And these files are each 3000x3000 px
    My computer has 8 cores and 1 photoshop exe is only using 1 cpu core
    Also i have SSD raid system it has 750 mb read write per second
    So right now i am wasting my time with running only 1 photoshop exe instead of at least 4

    I'm not aware of a way to run multiple instances or different versions of photoshop at the same time on windows.
    Assuming of course they are all installed on the same operating system.
    On mac versions you can running two different versions of photoshop at the same time, but i don't think that's possible on windows where it
    appears that only one version of photoshop can run at a time.

  • How can I load multiple compositions, all to play at the same time? eg 3 slideshows

    Hi
    Hoping someone at adobe edge animate can help me with some custom code as I need to load 3 different compositions all onto the same webpage.
    I have been through the Bootstrapper instructions thoroughly and have tweaked the code to try to get it to do what I require but I still can't make this work.
    I have 2 slideshows one footer one banner and also a small logo animation.. all need to reload and loop continuously.
    So far I have managed to get all three up but they all interfere with each other and none are playing properly.
    This is an urgent job for a client so I would really apprecaite some help.
    Thanks.. !
    Alayna.

    hi alayna,
    its definitely possible - see this sample:
    http://salesdigital.com/multiedge/
    3 edge compositions in one html page
    just check the page source code - in the head tag - it's not as bad as you think..
    hope this helps!
    ~keith

  • How can I create multiple versions of a video within the same project?

    OK...this is a probably a very basic question but I'm not sure how to word it clearly.
    How can I create multiple versions of a video within the same project? What I mean is that I have a bout 50 minutes of video and I want to make two DVDs using different clips from this original 50 minutes of footage. It would be a real pain to have to re-import the video AGAIN for the second DVD. I suppose I could drop anything I don't want to burn to DVD back into the clips pane but that would wipe out all my transitions wouldn't it? I want to save each project in their “raw” form so I can burn additional DVDs later otherwise I would just do them one at a time and not care about one of them being destroyed.
    Wow...that was a mess. Does anyone understand what the heck I’m asking? I hope so.

    How can I create multiple versions of a video within the same project?
    You can't. You make separate projects using the same or different clips, segments, transitions, titles, etc. You can even duplicate the first project and then modify/make the desired changes in the duplicated project. Each project can then be burned as a different DVD or as different titles on the same DVD if there is enough room.

  • I have a large number of photos imported into iPhoto with the dates wrong.  How can I adjust multiple photos (with varying dates) to the same, correct, date?

    I have a large number of photos imported into iPhoto with the dates wrong.  How can I adjust multiple photos (with varying dates) to the same, correct, date?

    If I understand you correctly, when you enter a date in the Adjust Date and Time window, the picture does not update with the date you enter.  If that is the case then something is wrong with iPhoto or your perhaps your library.
    How large a date change are you putting in?  iPhoto currently has an issue with date changes beyond about 60 years at a time.  If the difference between the current date on the image and the date you are entering is beyond that range that may explain why this is not working.
    If that is not the case:
    Remove the following to the trash and restart the computer and try again:
    Home > Library > Caches > com.apple.iphoto
    Home > Library > Preferences > com.apple.iPhoto (There may be more than one. Remove them all.)
    ---NOTE: to get to the "home > library" hold down option on the keyboard and click on "Go" > "Library" while in the Finder.
    Let me know the results.

  • How can I do to acquire and save date in the same time and in the same file when I run continual my VI without interrupti​on.

    I've attached a VI that I am using to acquire amplitude from Spectrum analyzerse. I tried to connect amplitude ouput to the VI Write Characters To File.vi and Write to Spreadsheet File.vi. Unfortunately when I run continual this VI without interruption, labview ask me many time to enter a new file name to save a new value.
    So, How can I do to aquire and save date in the same time and in the same file when I run continual my VI for example during 10 min.
    Thank you in advance.
    Regards,
    Attachments:
    HP8563E_Query_Amplitude.vi ‏37 KB

    Hi,
    Your VI does work perfectly. Unfortunately this not what I want to do. I've made error in my last comment. I am so sorry for this.
    So I explain to you again what I want to do exactly. I want to acquire amplitude along road by my vehicle. I want to use wheel signal coming from vehicle to measure distance along road. Then I acquire 1 amplitude each 60 inches from spectrum analyzer.
    I acquire from PC parallel port a coded wheel signal coming from vehicle (each period of the signal corresponds to 12 Inches). Figure attached shows the numeric signal coming from vehicle, and the corresponding values “120” and “88” that I can read from In Port vi.
    So I want to acquire 1 time amplitude from spectrum analyser each 5
    period of the signal that I am acquiring from parallel port.
    So fist I have to find how can I count the number of period from reading the values “120” and “88” that I am acquiring from In Port (I don’t know the way to count a number of period from reading values “120” and “88”).
    Here is a new algorithm.
    1) i=0 (counter: number of period)
    2) I read value from In Port
    3) If I acquire a period
    i= i+1 (another period)
    4) If i is multiple of 5 (If I read 5 period)
    acquire 1 time amplitude and write to the same
    file this amplitude and the corresponding distance
    Distance = 12*i). Remember each period of signal
    Corresponds to 12 Inches).i has to take these
    values: 5,10,15,20,25,35,40,45,50,55,60............
    5) Back to 2 if not stop.
    Thank you very much for helping me.
    Regards,
    Attachments:
    Acquire_Amplitude_00.vi ‏59 KB
    Figure_Algorithm.doc ‏26 KB

  • How many meetings can be opened by one account at the same time?

    I've tried Adobe Connect trial version.
    There are few questions about the product.
    1.How many meetings can be opened by one account at the same time?
       I could open 9meetings at the same time using other PCs. What is the limit?
    2.What is the maximum of students in a meeting?
       I'm thinking of buying monthly/Individual product.
    3.The meeting never end even though host is out of it. But we want to control.
       Can host close a meeting so that all participants are out of the session?
    Thanks for your attention.

    This depends on your licensing.
    If you are using a Named Host license, then you can open one meeting at a time. If other members of the Meeting Host group are present in a room, then it should allow you to have multiple rooms open, one for each Meeting Host licensing being used.
    If you are using the Concurrent Learner license, then each meeting you join uses a different licenses, so as long as you have concurrent seats available, you can open as many rooms as you want/need.
    Maximum number of attendees (students) would be your room's concurrent maximum, less your self. The monthly version of Connect offers 25 concurrent attendees in each room, so that would be 24 students and you.
    The meeting does end after it is dormant (no host) for ~15 min, however you can use the End Meeting function (Meeting > End Meeting) to close the meeting and remove everyone, including yourself, from the room.

  • Why can't I rotate multiple points in puppet warp at the same time?

    You can rotate single points in puppet warp, and you can shift+click to select multiple points and move them at the same time but I see no way to rotate multiple points as one group using puppet warp.  This would be a very helpful feature I think should be added.

    Please post Bug Reports and Feature Requests over at
    http://feedback.photoshop.com/photoshop_family/

  • Can I apply a Rights Management policy to multiple documents in a folder at the same time using Adobe Acrobat Pro?

    How can I apply a single Rights Management Policy to multiple documents in a folder at the same time instead of applying it to each document individually?

    I don't know of a method with Acrobat, why not set up a watch folder and just drop all the files in that folder to have rights applied.  You might want to look at the workbench help if you've not done this before.

  • How do i view itunes store and my library at the same time?

    how do i view itunes store and my library at the same time?

    apple killed this feature (and i'm really unhappy about this!!). please send a request to apple directly. they obviously don't read this forum. the more people complain about this, the better!
    http://www.apple.com/feedback/itunesapp.html

Maybe you are looking for