Appending in Code

M

mo

Hello all,

On closing a form I need to append all the records in one table to another
and delete them from the orginal table. I'm quite used to working with
recordsets and DAO, but have not used it in this way before.

Should I use the normal method with DAO, i.e. declaring a recordset
variable, specifying an SQL string, use rst.add and rst.update in a loop to
accompliish this task or is there a way in code to just run an append query.
Do I have to use Docmd.RunSQL?

TIA

Mo
 
P

Peter Hoyle

Hi Mo,

You could use DoCmd.RunSQL or

Dim dbs As DAO.Database
dbs.Execute("INSERT INTO etc.")
dbs.Execute("DELETE * FROM MyTable")

Not much point in running throught a recordset when SQL can do it for you,

Cheers,
Peter
 

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