UtterAccess.com
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
> Multiple Reports, Access 2010    
 
   
qwertnard
post Oct 29 2019, 12:39 PM
Post#1



Posts: 33
Joined: 3-April 08



I have a weekly report that goes out for each of my locations. What is the most efficient way of printing that report for each individual locations?
Go to the top of the page
 
theDBguy
post Oct 29 2019, 12:53 PM
Post#2


UA Moderator
Posts: 76,845
Joined: 19-June 07
From: SunnySandyEggo


Hi. Do you want to print all the reports at once?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
qwertnard
post Oct 29 2019, 01:26 PM
Post#3



Posts: 33
Joined: 3-April 08



Yes that would be preferable.
Go to the top of the page
 
GroverParkGeorge
post Oct 29 2019, 02:56 PM
Post#4


UA Admin
Posts: 36,178
Joined: 20-June 02
From: Newcastle, WA


The overall process would involve a number of steps and set up criteria, so it's going to take a bit of work.

First, you need a form with controls on it--probably a list box set to Multi-Select--that allows you to select one or more recipients from that list.

Then you need a command button on that form to launch the process, which will be a VBA function.

In that VBA function, you can either open a recordset based on the selected recipients and output the report for each one in turn, by looping that recordset, or you can just loop through the selected items in the list box and output the report for each. I'd probably go for the latter approach.

If you want to send the report to all recipients every time, with no ability to pick and choose among them, you can dispense with the list box and just launch the process in a VBA function via a command button's click event.

It would open a recordset consisting of each and every recipient and loop through it, creating the reports one at a time.

Whichever path you go, it's not hard, but it's going to take SOME VBA. Which do you think is more appropriate for your needs?

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
qwertnard
post Oct 29 2019, 03:39 PM
Post#5



Posts: 33
Joined: 3-April 08



Thank you for your suggestions @GroverParkGeorge. I will be going the last suggestion. I am off to youtube and I am awayyyy.
Go to the top of the page
 
GroverParkGeorge
post Oct 29 2019, 04:06 PM
Post#6


UA Admin
Posts: 36,178
Joined: 20-June 02
From: Newcastle, WA


Here's a skeleton Function that you could improve and expand then,

CODE
Private Sub PrintMyReports_Click()
    Dim rst As DAO.Recordset
    Dim rpt As Access.Report
    Dim lngCurrentLocation As Long

    Set rst = CurrentDb.OpenRecordset("Select * FROM MyLocationsTable")

    With rst
        Do While Not .EOF
            lngCurrentLocation = .LocationID
            DoCmd.OpenReport , reportName:="MyLocationReportName", view:=acViewNormal, wherecondition:=".LocationID = " & lngCurrentLocation
            .MoveNext
    
        Loop

    End With

End Sub


It is just a skeleton and you'll need to modify it to fit your database. I used a Select statement based on a table, but in your case, you might use a query instead because the query allows you to apply criteria like "ActiveLocations" only.

Also, I used View:=acViewNormal to send the report to the printer, but you could use one of the other options to open it in Print Preview, etc. for design or testing.

--------------------
My Real Name Is George. Grover Park Consulting is where I did business for 20 years.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
projecttoday
post Oct 29 2019, 05:02 PM
Post#7


UtterAccess VIP
Posts: 11,268
Joined: 10-February 04
From: South Charleston, WV


One way is to develop code that sends e-mails with the report attached.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    10th December 2019 - 10:48 AM