MS access

OK, Who can tell me how I can put the records from a Query into a table that already has data in it? at the push of a button?

Ended up with this

sqlstr = “INSERT INTO [det_done] SELECT * FROM [Det_Nom2]”
DoCmd.RunSQL sqlstr

I had to ensure all the field names were the same then it worked.

If the column (field) names are different you could try:

sqlstr = “INSERT INTO [det_done] (Col1, Col2) SELECT Col3, Col4 FROM [Det_Nom2]”

which works in SQL Server.

why not just make the query into an append query that adds it to the relevant table?

The query was generated / modified by Sql, the query is dynamic so using an append query wouldn’t work. I didn’t think the insert into would work initaly but it seems to work fine.

Be prepaired for more silly SQL / Access questions over the next few weeks as I’m building the biggest database I have to date at the mo. Monster project and only 8 weeks to do it in.

DAMSKI…Just IM me with questions anytime…I have a huge Library of VBA/ACCESS/VB Code in office.

Regards,
Greg (STEP2000)

Mega programming man Above me :wink: