By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 2,966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

Converting Macros to VBA Do command or execute

RockKandee
P: 89
Hi All,

I am using Access 2013 with Windows 8.

I am in the process of converting all of my macros into VBA. I read somewhere that it is better to use ? rather than do com. I cannot find it now to read it again.

I think it was execute....

I would love to get some input before I have too much code to fix - lol

So opinions on what code is best to use rather than, for example

Expand|Select|Wrap|Line Numbers
  1. DoCmd.SetWarnings False
  2.         DoCmd.OpenForm "DropAdventureMain", , , , , acDialog
  3.  
  4.         DoCmd.SetWarnings True
Thanks :)
Jan 25 '14 #1

✓ answered by zmbd

Each has merit so I leave it up to you to decide; however, you might want to read these two bytes threads:
http://bytes.com/topic/access/answer...db-execute-sql

http://bytes.com/topic/access/answer...sql-vs-execute

And then the following will cover some other aspects:
Executing SQL Statements in VBA Code

So when to use each depends alot on what and how you code.

The built in Macro to VBA conversion wizard will tend to use the docmd.runsql more often than not so such code may not always be optimal; however, it is still quite functional and (IMHO) only need be tweaked if there are performance issues.
(^_^)
-z

Share this Question
Share on Google+
3 Replies


zmbd
Expert Mod 5K+
P: 5,397
Each has merit so I leave it up to you to decide; however, you might want to read these two bytes threads:
http://bytes.com/topic/access/answer...db-execute-sql

http://bytes.com/topic/access/answer...sql-vs-execute

And then the following will cover some other aspects:
Executing SQL Statements in VBA Code

So when to use each depends alot on what and how you code.

The built in Macro to VBA conversion wizard will tend to use the docmd.runsql more often than not so such code may not always be optimal; however, it is still quite functional and (IMHO) only need be tweaked if there are performance issues.
(^_^)
-z
Jan 25 '14 #2

RockKandee
P: 89
Thank you!

Great info links and all in one handy location for me to find again :)
Jan 25 '14 #3

NeoPa
Expert Mod 15k+
P: 31,494
The author of the last one seems to know his stuff. I like what I read.
Jan 25 '14 #4

Post your reply

Sign in to post your reply or Sign up for a free account.