Is RunSQL using DAO? ADO? Something else?

M

Maury Markowitz

I'm in the process of removing all DAO code from a ADP project. I had
a bit of it sprinkled through the thousands of lines of VBA code.

To start with, I'm trying to decide whether or not I have to remove
or
change this line of code...

DoCmd.RunSQL "SET NOCOUNT ON"

For one, does RunSQL use DAO? If not, what does it use?

For another, if this does use DAO, what is the appropriate
replacement
that uses ADODB?

Thanks!

Maury
 
A

aaron.kempf

RunSQL does _NOT_ use DAO.

I'd just remove the refernece; and then see what doesn't compile.

Thanks & Good Luck

-Aaron
 
A

aaron.kempf

you can always use currentproject.connection.execute if you want

this should actually sink errors I think

-Aaron
 
T

Tony Toews [MVP]

Maury Markowitz said:
To start with, I'm trying to decide whether or not I have to remove
or
change this line of code...

DoCmd.RunSQL "SET NOCOUNT ON"

Actually we recommend using another solution. Following is my
standard blurb but remove the DAO stuff.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror
command instead of docmd.runsql. For ADO use
CurrentProject.Connection.Execute strCommand, lngRecordsAffected,
adCmdText

If you're going to use docmd.setwarnings make very sure you put the
True statement in any error handling code as well. Otherwise weird
things may happen later on especially while you are working on the
app. For example you will no longer get the "Do you wish to save your
changes" message if you close an object. This may mean that unwanted
changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two
methods. One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds. As always YMMV.
For one, does RunSQL use DAO? If not, what does it use?

No idea. Remove the DAO reference and see causes an error. If no
errors then not a problem.
For another, if this does use DAO, what is the appropriate
replacement
that uses ADODB?

See above.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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


Top