Insert Into

TheEvilSam

Registered User.
Local time
Today, 09:49
Joined
Jan 23, 2012
Messages
13
so I have a query that will insert into a table some values.

It goes as follows

INSERT INTO TblStockFinal (StockLevels)
SELECT (SUM(QrySales1.SalesByHalfPintBottleorCan))
FROM QrySales1
WHERE QrySales1.ProductID=1 OR QrySales1ProductID=2;

but this is not working.

Any Idea why.
 
but this is not working.
What does this mean? Does it throw any errors? If it does what is the error message? Please be more explicit.

Also, what's your reason of doing this? Calculated fields should not normally be saved, they should be calculated whenever you need them. It's only in very rare occasions where they are saved. Read this:

http://allenbrowne.com/casu-14.html
 
It is working, as such, It is giving a parameter box enter value for SalesByHalfPintBottleorCan

I'm not trying to store the data, Its gonna be stored long enough to create a report as there are 10 of these I need to do for the report then the tables data is going to be erased. not a perminant storage, just temporary.

all the names are correct, but I think I am referencing the query wrong. SalesByHalfPintBottleorCan is the name of the column and QrySales1 is the name of the query with the values in, I am trying to insert the sum of the values with Product ID 1 and 2
 
You still haven't justified why you need this value saved? And how do you think your database will work if you're doing this in a multi-user environment with the saving into a temp table and erasing from it.
 
I just thought It would be easier to Insert the values into a table to generate a report I could do it as a query I suppose, this is going to be generated via a button on a form in the admin section of the database.

the query I have for sales so far generates the following and I need to combine some of the values (1+2, 3+4, 5+6 etc) using the SUM function( I assume). I thought of the table as It would allow me to generate a description field and name the Items based on wat they are i.e. in the name field have carling when the stock volume is generate from summing items from the QrySales1 with ID 1 + 2



how would I go about doing this purely in a query with no table, If you could give me a walkthrough for say Carling and/or Carlsburg I could add the rest in myself

Thanks

Sam
 

Users who are viewing this thread

Back
Top Bottom