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

Turn a query into a table

If I run a query that calculates the sales data for all the inventory level
in a table, how do I go about saving that sales data into a permanent table?
I plan I using this sales data often, and running the query each time is
time consuming.

Is there a way to create a new table and import the query data into it?
What about the next time I run the query, can I just append the new data
into the table I just created? Can both of these be done with one query, or
do I need two queries; one that creates the table and imports and one for
just the import?

Is there a way to test for the tables existance first? If table exist then
import, else create table and import.
Jul 5 '06 #1
2 22822
In query design, choose Make Table from the Query menu.

Once you have the table, you can use an Append query instead of a Make
Table.

Instead of dropping and recreating the table, you can delete all records
with a Delete query.

If you want to automate this in a macro, use RunSQL.
The Execute method is more powerful if you are okay with code.
Details:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

If you leave the temporary table in place, you don't need to worry about
whether it exists, but if you want to do it anyway:
Not IsNull(DLookup("ID", "MSysObjects", "([Type] = 5) AND ([Name] =
'Query1')"))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John T Ingato" <jt******@hotmail.comwrote in message
news:12*************@corp.supernews.com...
If I run a query that calculates the sales data for all the inventory
level in a table, how do I go about saving that sales data into a
permanent table? I plan I using this sales data often, and running the
query each time is time consuming.

Is there a way to create a new table and import the query data into it?
What about the next time I run the query, can I just append the new data
into the table I just created? Can both of these be done with one query,
or do I need two queries; one that creates the table and imports and one
for just the import?

Is there a way to test for the tables existance first? If table exist
then import, else create table and import.

Jul 5 '06 #2
"John T Ingato" <jt******@hotmail.comwrote in
news:12*************@corp.supernews.com:
If I run a query that calculates the sales data for all the
inventory level in a table, how do I go about saving that
sales data into a permanent table? I plan I using this sales
data often, and running the query each time is time consuming.
First build your select query, maKe sure it's working right.
Make a copy to work on, so you don't lose everything if yu make
a mistake. Open the query in design mode. Right-Click in the
query. From the popup menu that appears, select query type->
make-table query. Enter a name in the dialog box. Save the query
and run it. Your new table has been created and filled with the
results of the query. If you run it a second time, it'll ask to
overwrite the existing table or cancel.
Is there a way to create a new table and import the query data
into it? What about the next time I run the query, can I just
append the new data into the table I just created? Can both
of these be done with one query, or do I need two queries; one
that creates the table and imports and one for just the
import?
Some data manipulation will benefit from filtering the data to
the current week and using an append query to add the current
week's data to an existing table. You build an append query
similarly to the make table, (just choose append query instead
of make-table query from the dialog) with one extra step. A new
row will appear in the design grid where you choose the column
name in the destination table.

>
Is there a way to test for the tables existance first? If
table exist then import, else create table and import.
Yes, but doing this requires visual basic code.
>


--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jul 5 '06 #3

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

Similar topics

2
by: Nik Coughin | last post by:
Today is the first time I've used MySQL with PHP. What is the best way to turn a column into an array? This is how I am doing it at the moment, surely this is sub-optimal: $query = 'SELECT...
11
by: RdR | last post by:
Hi, I am using Q Replication, I need to set to logging to capture changes on a table but the table has more than 18 characters for the name, I looked at the docs, it mentioned that table names...
3
by: sal cifone | last post by:
Hey, Is there any way to turn off the query parm prompts? I have a report that must be printed for 53 different cities and the vba code loops thru a table and passes the value to a select query....
5
by: HS Hartkamp | last post by:
Hi all, I am working with fairly large databases (> 500 Mb / < 2,000,000 rexcords), and often need to do action queries on these. I have the feeling that much of the computing power is going...
8
by: MLH | last post by:
I would like to modify the following SQL... INSERT INTO tblPmtsRcd (VehicleJobID, PmtAmt) SELECT GetCurrentVehicleJobID() AS MyVehicleJobID, !! AS MyPmtAmt; somehow so that an extra field in...
27
by: MLH | last post by:
How can I turn the following into a make-table query? SELECT & " " & AS Recipient FROM tblVehicleJobs INNER JOIN tblAddnlOwnrs ON tblVehicleJobs.VehicleJobID = tblAddnlOwnrs.VehicleJobID WHERE...
2
by: javamama | last post by:
Hi, I programmed a web page where two parallel maps can be explored with moving the cursor on the summer and winter buttons. The active button should turn red but now the right hand buttons turn...
22
kcdoell
by: kcdoell | last post by:
I have been trying for the last several days to create a query that will give me all of the values I need to create a report. Background: The report is different than anything I have done but...
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
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,...

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.