473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Converting Macros to VBA Do command or execute

RockKandee
89 64KB
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

3 1112
zmbd
5,501 Expert Mod 4TB
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
89 64KB
Thank you!

Great info links and all in one handy location for me to find again :)
Jan 25 '14 #3
NeoPa
32,556 Expert Mod 16PB
The author of the last one seems to know his stuff. I like what I read.
Jan 25 '14 #4

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

Similar topics

2
by: michaaal | last post by:
I feel a bit silly asking this because I use this code all the time, but what does the ",,129" mean? Are there other parameters that one might use (I only do fairly simple SQL commands). ...
5
by: What-a-Tool | last post by:
What is the proper format for my SQL str using command.execute? Even though I know I have matching data in my table, I keep coming up with a ..RecordCount of -1. What am I doing wrong? Thanks in...
2
by: Norman Fritag | last post by:
Hi there The below code executes some queries. As newbie I was wondering weather you are better of using connection execute or command execute to execute queries? I am asking as...
5
by: Ivan Weiss | last post by:
I am getting the following error from my error handling code: 5 - Expected query name after EXECUTE.. from the following code: Public Sub insert(ByVal argSql As String) Dim myConnection As...
8
by: Charles Law | last post by:
I am implementing the command pattern in VB.NET, where the commands have been serialised. That is, I have several classes that all inherit from my base Command class, that implements ICommand...
0
by: hien_tran | last post by:
I am trying to convert the following VBScript command that decrypts a file into .NET. pgp ohw06027.elg.pgp -z778 The first parameter is pgp which is the PGP decryption software. The second...
2
by: Wei Wang | last post by:
Hi, I want to do a select in dynamic command, something like: TRIGGER FUNCTION DECLARE table_name_suffix text; temp_result RECORD; temp_result2 RECORD;
0
by: polygonVB | last post by:
Hi All, I'm trying ot make a error handler function. I want the error handler function to return a command: Resume Resume Next Exit Sub I know how to return it as a sting but I don't...
4
by: George Varelas | last post by:
Hi, can anyone tell me how can I execute an external command such as dos command through my windows application which is built in C#. VB has the "Shell(...)" function but I couldn't find...
1
by: mikegolden | last post by:
An application I'm working on makes extensive use of output parameters and return values, thus forcing me to use the ADODB Command object to execute the stored procs. For recordset returning stored...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.