X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Dbengine(0)(0).execute Vs Docmd.runcommand    
post Sep 28 2011, 05:52 PM

Posts: 921
Joined: 1-October 10
From: North of the 49th Parallel

What's the difference?
know this probably doesn't apply to Errors + Error Handling in general, but the option is there to either use a
DBEngine(0)(0).Execute strSQL, dbFailOnError
DoCmd.RunSQL strSQL, dbFailOnError
I'm just wondering what the difference is between the two and if there is anything I should know. It seems like I need to run a SetWarnings command before and after the DoCmd approach to silence the Access warnings but I don't need to if I use the former approach.
Go to the top of the page
Doug Steele
post Sep 28 2011, 05:59 PM

UtterAccess VIP
Posts: 22,305
Joined: 8-January 07
From: St. Catharines, ON (Canada)

To the best of my knowledge, DoCmd.RunSQL strSQL, dbFailOnError is not valid syntax: the (optional) second parameter is UseTransaction, which can have a value of True (–1) to include this query in a transaction or False (0) if you don't want to use a transaction. If you leave this argument blank, the default (True) is assumed. dbFailOnError has a value of 128, so will be treated as True.
Take a look at what Allen Browne has to say about this topic in Action queries: suppressing dialogs, while knowing results.
Go to the top of the page
post Sep 28 2011, 06:12 PM

Posts: 921
Joined: 1-October 10
From: North of the 49th Parallel

Excellent article.
Thanks for the intel Doug.
Go to the top of the page
post Sep 28 2011, 09:56 PM

UtterAccess Editor
Posts: 18,007
Joined: 4-December 03
From: Northern Virginia, USA

Here is some more reading on the subject ...
.Execute vs .RunSQL
Go to the top of the page
post Jun 29 2020, 06:21 AM

UtterAccess VIP
Posts: 7,387
Joined: 30-June 11

One more reference worth checking out


Daniel Pineault (2010-2020 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc

All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    14th July 2020 - 08:19 AM