473,387 Members | 1,702 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,387 software developers and data experts.

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 qryPainControlTables:

SELECT Units.Units, FewMoreQuestions.WorstPain,
FewMoreQuestions.PainControlled, Count(FewMoreQuestions.FMQIDCode) AS
CountOfFMQIDCode
FROM Units RIGHT JOIN (Questionnaire LEFT JOIN FewMoreQuestions ON
Questionnaire.[ID Code] = FewMoreQuestions.SurveyIDCode) ON
Units.Number = Questionnaire.Unit
WHERE (((Questionnaire.[Survey Date]) Between
[Forms]![frmDates]![FirstDate] And [Forms]![frmDates]![LastDate]) AND
((FewMoreQuestions.WorstPain) Is Not Null And
(FewMoreQuestions.WorstPain)<>0) AND ((FewMoreQuestions.PainControlled)
Is Not Null And (FewMoreQuestions.PainControlled)<>0))
GROUP BY Units.Units, FewMoreQuestions.WorstPain,
FewMoreQuestions.PainControlled;

Mar 11 '06 #1
2 1559
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.googlegr oups.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 qryPainControlTables:

SELECT Units.Units, FewMoreQuestions.WorstPain,
FewMoreQuestions.PainControlled, Count(FewMoreQuestions.FMQIDCode) AS
CountOfFMQIDCode
FROM Units RIGHT JOIN (Questionnaire LEFT JOIN FewMoreQuestions ON
Questionnaire.[ID Code] = FewMoreQuestions.SurveyIDCode) ON
Units.Number = Questionnaire.Unit
WHERE (((Questionnaire.[Survey Date]) Between
[Forms]![frmDates]![FirstDate] And [Forms]![frmDates]![LastDate]) AND
((FewMoreQuestions.WorstPain) Is Not Null And
(FewMoreQuestions.WorstPain)<>0) AND ((FewMoreQuestions.PainControlled)
Is Not Null And (FewMoreQuestions.PainControlled)<>0))
GROUP BY Units.Units, FewMoreQuestions.WorstPain,
FewMoreQuestions.PainControlled;

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
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,...
11
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...
45
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)...
6
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...
5
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...
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...
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...
5
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...
3
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...
20
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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,...

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.