copy returned rows, changing foreign key..

N

nycdon

I have a form which returns budget items for a certain period. I'd like to be
able to call up a previous period's budget, then copy these rows changing the
period to give a template for a new budget period.
(keys are client_id and period)
any ideas appreciated!
thanks
 
P

pietlinden

use an inputbox or an unbound field on your form? Then just use
DBEngine(0)(0).Execute to execute the insert query to add the new
record...? There are several ways of doing this.
 
J

J. Goddard

If you don't have too many fields to copy, you can use an SQL insert to
new records into your table, with the source being itself. Assume the
new period number is to be 4, and you want to copy the records from
period 3:

Insert into BudgetTable (client_id,period,.....) select
(client_d,4,.....) from BudgetTable where period=3

The command inserts the constant 4 into period, instead of using the
existing table value.

John
 
Top