473,659 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looping Through Make-Table Query

I have been running make-table queries to create 10 tables (one for
each unit) that are exported to Excel spreadsheets. Because of my
limited knowledge with code, I've created 10 separate queries to do the
job and then run a macro to do the exporting. I know there must be a
way to generate the 10 tables with only one query and I think it
probably involves looping(?) through the query. I've read the previous
postings and anytime I try to apply the examples to my database I
cannot get it to work. I'm wondering if someone could explain how to do
this in a simple way. Here is the SQL for qryPainControlT ables:

SELECT Units.Units, FewMoreQuestion s.WorstPain,
FewMoreQuestion s.PainControlle d, Count(FewMoreQu estions.FMQIDCo de) AS
CountOfFMQIDCod e
FROM Units RIGHT JOIN (Questionnaire LEFT JOIN FewMoreQuestion s ON
Questionnaire.[ID Code] = FewMoreQuestion s.SurveyIDCode) ON
Units.Number = Questionnaire.U nit
WHERE (((Questionnair e.[Survey Date]) Between
[Forms]![frmDates]![FirstDate] And [Forms]![frmDates]![LastDate]) AND
((FewMoreQuesti ons.WorstPain) Is Not Null And
(FewMoreQuestio ns.WorstPain)<> 0) AND ((FewMoreQuesti ons.PainControl led)
Is Not Null And (FewMoreQuestio ns.PainControll ed)<>0))
GROUP BY Units.Units, FewMoreQuestion s.WorstPain,
FewMoreQuestion s.PainControlle d;

Mar 11 '06 #1
2 1575
Delores,

I'm assuming that you are making 10 different excel spreadsheets depending
upon some answer(s) or data that resides in your original query? If the 10
tables that you are creating are used only to export to Excel spreadsheets
and for no other purpose, you don't need to create the 10 tables. Tell me
more about the need for 10 separate "tables". What distinguishes one from
another?

Linda

"Delores" <de********@mts .net> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
I have been running make-table queries to create 10 tables (one for
each unit) that are exported to Excel spreadsheets. Because of my
limited knowledge with code, I've created 10 separate queries to do the
job and then run a macro to do the exporting. I know there must be a
way to generate the 10 tables with only one query and I think it
probably involves looping(?) through the query. I've read the previous
postings and anytime I try to apply the examples to my database I
cannot get it to work. I'm wondering if someone could explain how to do
this in a simple way. Here is the SQL for qryPainControlT ables:

SELECT Units.Units, FewMoreQuestion s.WorstPain,
FewMoreQuestion s.PainControlle d, Count(FewMoreQu estions.FMQIDCo de) AS
CountOfFMQIDCod e
FROM Units RIGHT JOIN (Questionnaire LEFT JOIN FewMoreQuestion s ON
Questionnaire.[ID Code] = FewMoreQuestion s.SurveyIDCode) ON
Units.Number = Questionnaire.U nit
WHERE (((Questionnair e.[Survey Date]) Between
[Forms]![frmDates]![FirstDate] And [Forms]![frmDates]![LastDate]) AND
((FewMoreQuesti ons.WorstPain) Is Not Null And
(FewMoreQuestio ns.WorstPain)<> 0) AND ((FewMoreQuesti ons.PainControl led)
Is Not Null And (FewMoreQuestio ns.PainControll ed)<>0))
GROUP BY Units.Units, FewMoreQuestion s.WorstPain,
FewMoreQuestion s.PainControlle d;

Mar 11 '06 #2
Each table contains the survey results for a separate hospital unit.
Each unit has it's own excel spreadsheet in which graphs are
automatically updated when new data is exported.

Mar 12 '06 #3

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

Similar topics

2
7592
by: BeWyched | last post by:
I'm trying to extract data from a simple XML document that holds the data in 2 levels by looping through the levels. Simplified code is: Dim doc As New XmlDataDocument Dim strngs As String, strng1 As String, strng2 As String Dim Node1 As XmlNode, Node2 As XmlNode strngs = "<ABC><XYZ>Smith<EFG>Jim</EFG><EFG>Freddy></EFG><EFG>Bill</EFG></XYZ><XYZ>Jones<EFG>Gill</EFG><EFG>Jack</EFG></XYZ></ABC>") doc.LoadXml(strngs)
11
2606
by: Lyle Fairfield | last post by:
The stored procedure script below is an example of how looping, case statements and output parameters can be used in MS-SQL stored procedures to accomplish things for which we may have had to use VBA code, or automation, in the JET world. Some who have not yet worked with MS-SQL may be interested. The script is indented in reality but I have aligned it all left to make reading easier, (I hope). The Sproc takes an Account ID, an...
45
7437
by: Trevor Best | last post by:
I did a test once using a looping variable, first dimmed as Integer, then as Long. I found the Integer was quicker at looping. I knew this to be true back in the 16 bit days where the CPU's (80286) word size was 16 bits same as an integer. Now with a 32 bit CPU I would have expected the long to be faster as it's the same size as the CPU's word size so wouldn't need sawing in half like a magician's assistant to calculate on like an...
6
1827
by: Mike | last post by:
Hello, This game will not loop. It compiles, builds, and executes fine, but the game will not loop around no matter what I do. What is wrong with the code? What do I have to add to make it loop till the person selects "N" or "n". #include <stdio.h> #include <stdlib.h>
5
2412
by: masood.iqbal | last post by:
My simplistic mind tells me that having local variables within looping constructs is a bad idea. The reason is that these variables are created during the beginning of an iteration and deleted at the end of the iteration. Kindly note that I am not talking about dynamically allocating memory within a loop, which is a perfectly valid operation (albeit with a chance of resulting in a memory leak, unless we are careful). The most common...
0
1533
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 that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
0
1401
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 that would Populate another Listbox/datagrid. Then it would cycle through the selections made in the populated listbox/datagrid and do some calculations. The calculations made would have to add the first two numbers in the populated...
5
3996
by: johnb41 | last post by:
I need to loop through a bunch of textbox controls on my form. The order of the loop is very important. For example, the top one must be read first, then the one below it, etc. My first attempt was to put the controls in a Panel, and then loop through the controls collection of the panel. What happened is it read the controls from the bottom of my form to the top! So I tried a more manual process. I named each textbox like this:
3
3721
by: Andy | last post by:
Hello, I have the following situation: Thread A is allocating a dataset, doing some low-level calculations and storing a pointer to the dataset in a std::list via push_back. Thread B should retrieve the pointer to the first dataset in the list, remove it from the list, and do some high level analysis. The problem now is, how do I efficiently retrieve the pointer?
20
2831
by: Ifoel | last post by:
Hi all, Sorry im beginer in vb. I want making programm looping character or number. Just say i have numbers from 100 to 10000. just sample: Private Sub Timer1_Timer() if check1.value= 1 then
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8751
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7360
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4176
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.