add records to table through ado

G

Guest

Hi to all,
On a form a have a command button. When I click on the button a parametrized
query is run against a table (tbl1) returning 16 records only. Each record
contains 3 numeric fields (f1, f2, f3). By some means (a loop? a query?) I
would like to change the numeric value of the first field only (f1), for each
record, leaving everything else as it is. Next I would like to add these 16
modified records to my original table. (I don't want to modify the original
16 records, I just want to add 16 new (modified) records to my table). I'm
new to ado and I'm not sure how to do this without affecting the existing
records. Any help would be greatly appreciated especially if it included any
sample code.
Thanks in advance, George
 
K

kingston via AccessMonster.com

I recommend that you use an append query to add the data:

INSERT INTO tlb1(f1,f2,f3) SELECT 100*[f1], [f2], f3] FROM tbl1;

You can create this query visually and then use DoCmd.OpenQuery "QueryName"
to run it from the command button or you can add this SQL statement in your
code and use DoCmd.RunSQL SQLstring.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top