execute a query

  • Thread starter Thread starter iccsi
  • Start date Start date
I

iccsi

I wanted to execute an append query

I tried to use docmd.openquery which open the query, but does not
append the records.


Any way using VBA to execute an append query?

Your help is great appreciated,
 
I wanted to execute an append query

I tried to use docmd.openquery which open the query, but does not
append the records.


Any way using VBA to execute an append query?

Your help is great appreciated,

At least two:

DoCmd.RunSQL "INSERT INTO..."

or, better because it traps errors and doesn't give you a nag prompt warning
that you're about to run a query that will modify data:

Dim db As DAO.Database
On Error GoTo Proc_Error
Set db = CurrentDb
db.Execute "yourqueryname", dbFailOnError
Proc_Exit:
Exit Sub
Proc_Error:
<do your error handling here>
Resume Proc_Exit
End Sub
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Back
Top