Access VBA run Query or run Action Query

This Access VBA tutorial explains how to run Query and run Action Query in Access VBA. Access VBA run Query or Action Query Imagine you have to run 10 Action Query (e.g. Create Table, Update, Delete Table) in a row to get the final result, you have to run each Action Query one by one and the most annoying part is to click the confirmation dialogs. With Access VBA we can run a series of Action Query automatically and skip all the confirmation dialogs, saving a lot of time. In the following e...
More

Access VBA loop through all Tables using DAO.TableDef

This Access VBA tutorial explains how to loop through all TablesĀ using DAO.TableDef in Access. You may also want to read: Access VBA loop through Table records Access VBA loop through all Tables Let's say we use a Macro to import 100 Tables and then we want to delete them all. It is time consuming for us to delete one by one and there is a high risk of manual error of deleting the wrong one. In this case we want to write a Macro to loop through all Tables to delete all Tables that meet c...
More

Access VBA loop through Table records

This Access VBA tutorial explains how to loop through Table records or Query records in Microsoft Access. You may also want to read: Access VBA loop through all Tables using DAO.TableDef Access VBA loop through Table records Suppose we have an Acess Table or Query and you want to loop through the records (in Excel terms, to loop the values in each row), we have to make use of Recordset objects, which has different Methods to help us manipulate data in a database at the record level. I...
More

Access Excel VBA Array

This VBA tutorial explains how to create and use VBA Array in Access and Excel VBA. You may also want to read: Store unique array item with Scripting Dictionary Access Excel VBA Array In Excel worksheet, you can convert a formula arguments to Array by pressing CTRL+SHIFT+ENTER, click here to see example. In VBA, Array is a variable that can store multiple data of the same data type. There are two types of Array in VBA One-dimensional Array Two-dimensional Array For most...
More

Run Access Macro using RunCode

This Access tutorial explain how to run Access Macro using RunCode. You may also want to read: Run Excel Macro from Access VBA Run Access Macro Assume that you have already written a Sub Procedure helloWorld(). To run the Macro, you can press ALT+F11 and run the Procedure by pressing F5.   Alternatively, go back to the Access Windows, double click on the Module on the left hand side and run the Procedure by pressing F5. If you are writing a Macro for users, they pro...
More

VBA Difference between Dim Set

This Access/Excel VBA tutorial shows the difference between Dim and Set keyword in variable declaration. You may also want to read: Excel VBA Option Explicit to force declaration of variables Difference between ByRef ByVal Function, Sub, Method, Property Differences VBA Difference between Dim and Set In VBA, we can always see the use of Dim and Set, but in some occasions we don't. Example 1: Dim rng as Range 'Optional Set rng = Range("A1") Example 2: Dim s as String 'Op...
More

Difference between ByRef ByVal in Access Excel VBA

This tutorial explains difference between ByRef ByVal in Access Excel VBA. You may also want to read: Difference between Dim and Set Excel VBA Option Explicit to force declaration of variables Function, Sub, Method, Property Differences Difference between ByRef ByVal in Access Excel VBA ByRef means to pass a variable or Object by Reference (memory address). ByVal means to pass a variable or Object by Value. When you define a Function with arguments, you can define the variable ...
More

Run Excel Macro from Access VBA

This Access tutorial explains how to run Excel Macro from Access VBA, either write Excel Macro directly in Excel or you can write Excel Macro in Access. You may also want to read: Run Access Macro using RunCode Run Excel Macro from Access VBA One of the uses to run Excel Macro from Access is when you use VBA to export tons of Access reports to Excel. By default, exporting Access report as Excel gives you no formatting but plain text. However, it would be convenient if you can export th...
More