473,472 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Looping question

6 New Member
I am automating a database for a client and I have run into a problem. I have researched it enough to know that I have to set up a loop. But, I can not find any code that will help me accomplish this. I am doing this in Access 2003.

The problem is:

I have a table with 25k records. Within these records I have around 100 unique manager values. I have built a query to group the managers together. Now what I want to do is to find a way to create 100 individual Excel 97-2003 files based on these manager groupings. So, for instance, 50 records containing value "SteveManager" in the manager field would become an excel spreadsheet named SteveManager.xls, and so on. This data is going to be overwritten every 3 months, so even creating 100 manual queries 1 time won't work because I would just have to redo it the next time since new managers are added/removed. Any help would be greatly appreciated!

Jodie
Dec 22 '06 #1
6 1602
MMcCarthy
14,534 Recognized Expert Moderator MVP
I am automating a database for a client and I have run into a problem. I have researched it enough to know that I have to set up a loop. But, I can not find any code that will help me accomplish this. I am doing this in Access 2003.

The problem is:

I have a table with 25k records. Within these records I have around 100 unique manager values. I have built a query to group the managers together. Now what I want to do is to find a way to create 100 individual Excel 97-2003 files based on these manager groupings. So, for instance, 50 records containing value "SteveManager" in the manager field would become an excel spreadsheet named SteveManager.xls, and so on. This data is going to be overwritten every 3 months, so even creating 100 manual queries 1 time won't work because I would just have to redo it the next time since new managers are added/removed. Any help would be greatly appreciated!

Jodie

Can you post a reply to this thread on Wednesday/Thursday to bump it up the list. It may not get much attention over Christmas.

Happy Holidays.

Mary
Dec 25 '06 #2
Killer42
8,435 Recognized Expert Expert
Can you post a reply to this thread on Wednesday/Thursday to bump it up the list. It may not get much attention over Christmas.
Sounds as though you'd probably want to use some VBA code to loop through the "manager values" and do a DoCmd TransferText for each.
Dec 27 '06 #3
raneking22
6 New Member
What would be a good resource to find example of looping code to run through the managers? I may not have said this in my initial post, but I know very little VBA.

Thanks,

Jodie
Dec 27 '06 #4
NeoPa
32,556 Recognized Expert Moderator MVP
This isn't that easy for a newbie Jodie, but basically :
1. Produce a query to list each manager including their name in the results (once only per manager).
2. Process through this query in a VBA loop (there are examples of such things here in these forums).
3. For each item create or update an existing QueryDef (saved Access Query) whose SQL restricts the output to those records matching your manager name.
4. Using DoCmd.TransferSpreadsheet, export this newly created or updated QueryDef to create each individual manager's spreadsheet.

You may need help in some of these steps but let us know how far you get on your own first.
Dec 28 '06 #5
MMcCarthy
14,534 Recognized Expert Moderator MVP
Have a look at the following to get you started.

Basic VBA recordset Query

Happy New Year!

Mary
Jan 1 '07 #6
NeoPa
32,556 Recognized Expert Moderator MVP
Have a look at the following to get you started.

Basic VBA recordset Query

Happy New Year!

Mary
Brilliant Mary!
A great idea to put some basic code in a link like that.
Now we just wait until KUB's ready with the new section so that people can find them a little more easily.

-Ade.
Jan 1 '07 #7

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

Similar topics

4
by: Colin Steadman | last post by:
I've create a simple survey using ASP. Its finished and works, but one aspect of my coding is annoying me and I cant figure out a better way of doing it. Basically the questions are stored in...
0
by: | last post by:
Greets All, Question on data in datagrid /listbox and looping? I’m trying to decide the best way to write this code. 1 would like the user to make several selections from one listbox/combo box...
2
by: clinttoris | last post by:
Hello, If someone could help me it would be appreciated as I am not having much luck. I'm struggling with my asp code and have some questions relating to asp and oracle database. First...
2
by: Davaa | last post by:
Dear all, I am a student making a MS Form application in C++. I would ask a question about "Timer". Sample code which I am developing is below. private: System::Void...
3
by: chiku1523 | last post by:
Hi, Please find the following code. In function setAnswers, I am looping with each question. I have inner loop, which is looping for each answers of the questions. If any of the answer for question...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.