RunSQL Vs Execute ?

  • Thread starter Thread starter mscertified
  • Start date Start date
M

mscertified

What is the difference between (and is either preferred):

Docmd.RunSQL "SQL statement"

and

CurrentProject.Connection.Execute "SQL statement"
 
What is the difference between (and is either preferred):

Docmd.RunSQL "SQL statement"

and

CurrentProject.Connection.Execute "SQL statement"

One big difference is that the former does not let you trap errors, and the
latter does.
 
It's been so long since I've used RunSQL.

Doesn't it require SetWarning Off/On to prevent warnings as well?

--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
It's been so long since I've used RunSQL.

Doesn't it require SetWarning Off/On to prevent warnings as well?

Yep - that's another of its disadvantages vis a vis the Execute method.
 
And the .execute method allows you to get the 'records affected' count back -
which is sometimes very useful.
 

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

Similar Threads

VBA -- SQL 9
RunSQL vs Execute 10
Class Module Choices 6
Problem with DoCMD.RUNSQL Select statement 7
Find record RunSQL in a crosstab query 11
Run-Time error '2342': 1
DoCmd RunSQL parameters 5
SQL in VBA 2

Back
Top