Link to home
Start Free TrialLog in
Avatar of dotthei
dotthei

asked on

What is wrong with DoCmd.RunSQL

Shane pissed in my Cheerios :-)

He mentioned that when he was first learning Access, he did silly things like "...DoCmd.RunSQL..."

I was enjoying my dinner until I read that.  What alternatives are there?  What did I miss in Access 101?  I love my DoCmd.RunSQLs.  How am I to live without them?

C'mon 1William, TextReport, Jim - and any other guru I might fail to mention -  please help me dry out my cereal bowl!

Did he mean that I am supposed to open recordsets and control my table values from there?
ASKER CERTIFIED SOLUTION
Avatar of shanesuebsahakarn
shanesuebsahakarn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great info, Shane. I always use the .Execute method but I wasn't aware of a couple of the benefits you posted.

Do you know any links with more detail?

Gracias mi amigo!

Mike
The A97 help file was the one for me. I don't really use the A2K2 help files as it's such a pain to try and find anything in them!
Avatar of dotthei
dotthei

ASKER

LMAO
Shane, you are not supposed to answer this question.

I counted the occurences of DoCmd.RunSQL in my most recent customer app.  103 of 'em.  I am glad that I have already cashed (and spent) the check.

I am sold on FASTER.  Any increase in speed is VIP.

I tend to add SetWarnings True on all Form Open events.  Just in case.  I have fat-finger deleted objects from the Access window.  Actually, it only happened a few times on a single day back in 1996.  You know how it is when you are red-eye tired, 14 hours into the day and the Delete command is so close to the Rename command.  And my cat just loves to sleep on my keyboard.

Isn't the value 1,
DoCmd.RunSQL "Some SQL String;", 1
the Use Transaction flag ?

In bullet 6, are you saying that
DoCmd.RunSQL "Some SQL String;", 1
becomes
CurrentDb.Execute "Some SQL String"

- wait on that...
I have an F1 key.  I wonder what it does?

What's a pass-through query?  ;-)
Actually, I've never used RunSQL for transactions....I don't know how well this works, although I'm sure it has the same effect. You still don't get all the rest of the funky things Execute can do though :)