473,405 Members | 2,334 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,405 software developers and data experts.

code to export to multiple Excel worksheets within single workbook

I have a table in Access with about 3000 records. There are ~60 unique
values in the ID field for the 3000 records. What I would like to do
is automatically generate multiple Excel worksheets within a single
workbook with these records. I would end up with around 500
worksheets, 1 for each unique ID value. I was thinking this could be
done if I have an exported flag column in the table, and I search for
the max (or min) on the ID field, select those, and export those into a
worksheet, and set the flag to yes. Then the process could be run from
the beginning again so that it selects the next set of records for the
max, and exports those.

Does anyone have code that would do this?

Mar 27 '06 #1
4 8682
pa*******@gmail.com wrote in
news:11**********************@j33g2000cwa.googlegr oups.com:
I have a table in Access with about 3000 records. There are
~60 unique values in the ID field for the 3000 records. What
I would like to do is automatically generate multiple Excel
worksheets within a single workbook with these records. I
would end up with around 500 worksheets, 1 for each unique ID
value. I was thinking this could be done if I have an
exported flag column in the table, and I search for the max
(or min) on the ID field, select those, and export those into
a worksheet, and set the flag to yes. Then the process could
be run from the beginning again so that it selects the next
set of records for the max, and exports those.

Does anyone have code that would do this?

You'd be a lot better off to export the entire recordset into Excel
and build a pivot table to do your selection.

The question I have is why have 500 separate worksheets?

--
Bob Quintal

PA is y I've altered my email address.
Mar 27 '06 #2
PCD
Boob ---

<<You'd be a lot better off to export the entire recordset into Excel and
build a pivot table to do your selection.>>
You forgot to tell the OP your patented, WELL DOCUMENTED technique to export
all the records by exporting one field at a time. Or maybe this isn't such a
perfectly correct technique after all!!

<<The question I have is why have 500 separate worksheets?>>
Answer - the OP looked at your previous response to another OP wanting to
export Access records to Excel, followed your recommendation and exported
the records one field at a time!!

Er-rr If there are 3000 records and ~ 60 unique values and the OP wants 1
worksheet for each unique ID, that sounds like 60 worksheets, not 500
worksheets. INDEED, that assumes the OP does not try the patented, WELL
DOCUMENTED technique of exporting one field at a time!!!

INDEED, INDEED, INDEED!!!!
"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
pa*******@gmail.com wrote in
news:11**********************@j33g2000cwa.googlegr oups.com:
I have a table in Access with about 3000 records. There are
~60 unique values in the ID field for the 3000 records. What
I would like to do is automatically generate multiple Excel
worksheets within a single workbook with these records. I
would end up with around 500 worksheets, 1 for each unique ID
value. I was thinking this could be done if I have an
exported flag column in the table, and I search for the max
(or min) on the ID field, select those, and export those into
a worksheet, and set the flag to yes. Then the process could
be run from the beginning again so that it selects the next
set of records for the max, and exports those.

Does anyone have code that would do this?

You'd be a lot better off to export the entire recordset into Excel
and build a pivot table to do your selection.

The question I have is why have 500 separate worksheets?

--
Bob Quintal

PA is y I've altered my email address.

Mar 28 '06 #3
I told you to go away.

Don't go away mad.

Just go away.

"PCD" <no***@email.com> wrote in
news:0f******************@newsread3.news.atl.earth link.net:

the babblings of a psychopathic idi10t

--
Bob Quintal

PA is y I've altered my email address.
Mar 28 '06 #4
PCD
Tsk, Tsk, Tsk, Boob!!!

INDEED!
"Bob Quintal" <rq******@sympatico.ca> wrote in message
news:Xn**********************@207.35.177.135...
I told you to go away.

Don't go away mad.

Just go away.

"PCD" <no***@email.com> wrote in
news:0f******************@newsread3.news.atl.earth link.net:

the babblings of a psychopathic idi10t

--
Bob Quintal

PA is y I've altered my email address.

Mar 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet. mainly i need to export data to multiple worksheets. it is very urgent to us. thanks Regards gaffar.
0
by: priya0123 | last post by:
Hi, I have written an application where onclick of a button, asp.net page is exported to an excel spreadsheet. But now the client want to have multiple spreadsheets. for example sheet1 has some...
1
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Hi, I'm using ASP.NET 1.1 and trying export a dataset with multiple datatables (each to it's own Excel worksheet.) I've successful bound a DataTable a DataGrid using the code below but I...
10
by: charvi | last post by:
Can I generate more than 1 Excel sheet when a command button is clicked? For eg I search for 2 names of audit dept and click print command button where records will be printed in Excel. Again if I...
3
habby0123
by: habby0123 | last post by:
I am trying to export data to Excel from a query in Access. There is a unique "Sales Region ID" and various "Territory#'s" for each Region. I would like one excel workbook for each region, and a...
0
by: appu123 | last post by:
How can we copy multiple Excel Sheets into a new Workbook. I was trying to copy using File::Copy, but it does not help as it overwrites the existing details
6
by: shilpag | last post by:
How to export data to multiple excel worksheets using php can anyone help on this please
11
by: Shannon West | last post by:
I have recently acquired the job of updating our Access dB (2000 version) and I am a bit over my head here (my work with Access was limited to entering information into forms or running the reports...
1
by: Sekhar C | last post by:
I have 100 excel sheets with same field name,with same number of fields,with similar datatype. i want to transfer data from all excel sheets to one Sql database Table using one Package, i am using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.