View Full Version : sql code for Append Qry


mrrayj60
02-14-2010, 12:28 PM
I need some help adding records from one table to another. I want to add a record for a date range the user enters. The fields from VRC would be added to VRC Fines would be duplicated except for one, Finedate. That field would be for the dates the user inputs. He enters 01/01/10 - 01/07/10 would be 7 appends each new append would have a unique date between 1/1 and 1/7. I think what I need is a stored value and the value is the date range. Can anyone help? Thanks, Ray, access2003

Here is my code that does not work.
INSERT INTO vrcfines ( ubl, Name, [vrccase#], complaintid, complaint, fineamnt, finedate )
SELECT vrc.UBL, vrc.NAME, vrc.[VRCCase#], vrc.Complaintid, vrc.COMPLAINT, vrc.Fine, xdate AS Expr1
FROM vrc
WHERE (((vrc.Complaintid)=132) AND xdate = ((xdate) Between [xdate] And [xdate]));

llkhoutx
02-20-2010, 07:35 PM
Change ...vrc.Fine, xdate AS Expr1... to ...vrc.fine as fineamnt, xdate AS finedate...

llkhoutx
02-20-2010, 07:36 PM
Change ...vrc.Fine, xdate AS Expr1... to ...vrc.fine as fineamnt, xdate AS finedate... This is a Query question, not a SQL Server question.

stonemethew
03-11-2010, 09:18 PM
My usual approach is to create and save the pass-through query, then create a second query which uses the pass-through as a data source and does the append. Then you have no confusion as to which environment you're in -- and you can re-map data using local Access tables if necessary.