473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

batch export of reports

Hi there,

I was wondering if anyone could suggest a method using only access ( ie no additional applications) to batch export reports to excel. Basically i have a report with a query for its source data, and the query is based on the selection of an employee from a drop down list. It would be terrific if i could batch export a report for each employee.

Hopefully someone out there has the answer
Nov 26 '08 #1
7 5122
ADezii
8,834 Expert 8TB
I recently responded to a very similar Thread. and I'll try to find it for you. In the meantime, the process is:
  1. Open the Report in Design View.
  2. Dynamically set the Record Source of the Report based on Employee IDs contained within some kind of Looping Structure.
  3. Close and Save the Report.
  4. Export the Report.
Nov 26 '08 #2
ADezii
8,834 Expert 8TB
Well, I couldn't find the Thread that I was referring to, but I re-wrote it from scratch, so here goes:

ASSUMPTIONS:
  1. Table Name: Employees
  2. Report Name: rptEmployees
  3. Primary Key in Employees Table: EmployeeID
Expand|Select|Wrap|Line Numbers
  1. Dim MyDB As DAO.Database
  2. Dim rpt As Report
  3. Dim rstEmployee As DAO.Recordset
  4.  
  5. Set MyDB = CurrentDb()
  6. Set rstEmployee = MyDB.OpenRecordset("Employees", dbOpenForwardOnly)
  7.  
  8. With rstEmployee
  9.   Do While Not .EOF
  10.     DoCmd.OpenReport "rptEmployees", acViewDesign
  11.     Reports![rptEmployees].RecordSource = "Select * From Employees Where Employees.[EmployeeID] = " & _
  12.                                            ![EmployeeID]
  13.     DoCmd.Close acReport, "rptEmployees", acSaveYes
  14.     DoCmd.OutputTo acOutputReport, "rptEmployees", acFormatXLS, CurrentProject.path & "\Employee_" & _
  15.                                    ![EmployeeID] & ".xls"
  16.     .MoveNext
  17.   Loop
  18. End With
Nov 26 '08 #3
thanks for the code.... just one question.... How do i implement this loop code as the record source, it seems to only want to let me select queries or tables, i cant get to code builder from there.

thanks again for all the help thus far
Nov 26 '08 #4
ADezii
8,834 Expert 8TB
The code will do it all, just set the RecordSource of rptEmployees to the Employees Table, set the Control Sources of all Bound Fields, and you are set to go. Execute the code from wherever you wish.
Nov 26 '08 #5
PianoMan64
374 Expert 256MB
@barrhaven01
Hello barrhaven01,

In order to do what Adezii is speaking of, you need to open up the code module and create a subroutine that will make the changes that he's speaking about to your report. You're not able to do set it on the RecordSource field within the report. It has to be done in CODE.

Hope that helps,

Joe P.
Nov 26 '08 #6
ADezii
8,834 Expert 8TB
Thanks Joe P. for the assist, sometimes I miss the obvious! (LOL).
Nov 27 '08 #7
im incredibly stupid.... i cant seem to get this to run.

Also I was wondering how the code would change if rather than a report for each employee, if it summarrized each employee by office building.
Nov 27 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Goran Djuranovic | last post by:
Hi everyone, I copied an asp.net project to another machine by using "Copy Project" menu item from "Project" menu in VS.NET 2003 IDE. The project contains Crystal Reports that are being exported...
0
by: Bill Sharp | last post by:
Hi, I have a Stored Procedure that takes about 20 minutes to fill a Dataset, then I bind it to a report and try to export in a PDF format. It works with my smaller reports, but not my biggest -...
0
by: Leo Heska | last post by:
Hi I haven't seen the following problem mentioned anywhere We have an application written in VB.NET which executes a batch file (named startJob.cmd). We have discovered that if that batch file...
1
by: Grant Szabo | last post by:
I need to export a report with stored procedure parameters from ASP.NET. I cannot find any way to set the parameters from the ReportDocument object. I'm using C# on ASP.NET with Crystal v9 and...
0
by: Henry | last post by:
I have written an ASP/VB.Net application via VS 2003 (Crystal V9) that uses MS Access 2000 as its database. I can export reports that have no linked sub reports for printing. However, I'm unable...
1
by: simon.robin.jackson | last post by:
Ok. I have a database. I have a report. I want to batch export this report to either html/xml/rtf files. However, at present, the problem is that by default, I can batch export to html but it will...
1
by: sisieko | last post by:
I have an access adp (MS Access 2003) connecting to a SQL 200 server. From the adp a user generates reports and using the built-in access export wizard can export said reports (which are either...
22
Missionary
by: Missionary | last post by:
I need to batch print reports. I've looked at past posts about batch printing, but I don't know visual basic, so I'll need some coaching. I have a report based on a parameter query. I have it...
4
by: Mythran | last post by:
Reposted, originally posted in microsoft.public.vb.crystal which is not an MSDN managed newsgroup.... POST BELOW --------------------- We develop our applications and reports using Visual...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.