Appending data within same table with criteria

  • Thread starter Thread starter B K
  • Start date Start date
B

B K

I have a tabel tblYearPrice which contains Costprice per Year Per
Item:
YearPriceID = autokey
ItemID = numeric
Costprice = currency
Year = text

I wanna copy all the records of year =2001 to 2002 in the same table
so i can after that the costpice per item for 2002. I created a
append query which looks like this:
INSERT INTO tblYearPrice ( Item, Costprice, Year )
SELECT Item, Costprice, "2002" AS Expr1
FROM tblYearPrice
WHERE ((("2002")="2001"));

Why doesn't work this? I hate to build an maketable, update and
append query instead to fix this problem
 
Firstly, Year is not a good name for your field in your table as Year is the
name of a built in function to return the year part from a date.
Put single qoutes around the 2002 as Expr1 instead of double.
I have not tested, but try this in your WHERE clause instead

WHERE Year([Year]) = 2001
 
Further to my last post, If year in your table is just the year and not a
date then I have made a mistake. Your WHERE should be like this

WHERE [Year] = '2001'
 
Well the tablenames are actually in dutch , the query looks orginally
likes this
INSERT INTO JaarTarieven ( KostenSoortID, Tarief, Jaargang )
SELECT JaarTarieven.KostenSoortID, JaarTarieven.Tarief, '2002' AS
Expr1
FROM JaarTarieven
WHERE ((('2002')='2001'));

Year=jaargang
From a selection of records with criteria '2001' I want to append
this to the same table but filled in '2002' in field jaargang (year)



28-10-2005 14:36:06
Further to my last post, If year in your table is just the year and not a
date then I have made a mistake. Your WHERE should be like this

WHERE [Year] = '2001'

B K said:
I have a tabel tblYearPrice which contains Costprice per Year Per
Item:
YearPriceID = autokey
ItemID = numeric
Costprice = currency
Year = text

I wanna copy all the records of year =2001 to 2002 in the same table
so i can after that the costpice per item for 2002. I created a
append query which looks like this:
INSERT INTO tblYearPrice ( Item, Costprice, Year )
SELECT Item, Costprice, "2002" AS Expr1
FROM tblYearPrice
WHERE ((("2002")="2001"));

Why doesn't work this? I hate to build an maketable, update and
append query instead to fix this problem
 
Back
Top