It is common to create a big wall of declaration in a module such as this: While the code will compile and work fine, the discoverability and naming of the module level variables does become difficult and unwieldy. To help cut down on this ambiguity, it is recommended to create a private user-defined type instead….
Prefer compile time errors over run time errors
In VBA, there are several features that allow us to do things that may not be checked at the compile time. In particular, it is possible to write several late-bound expressions which means that it can potentially contain run-time errors. One common misconception about late-binding is that it’s a matter of adding a reference and…
Minimizing stateful code
First we need to define what a state is. A state means that the object has variable(s) that may cause it to behave differently, depending on the content of the variables. As an example, the Forms collection is stateful: This is legal code and will compile but we can’t be assured that this will work…
Self-documenting code
Strong preference should be given to writing code that is self-documenting. A common approach is to write a lot of comments, but the problem with comments are twofold: It actually can harm the readability because it adds to the overall length of code to read and understand. It must be correct or it can end…
#LateBind Constant
In standard code, we make use of #LateBind conditional compilation constant, which is typically defined via project’s Conditional Compilation Argument in the dialog: NOTE: The dialog can be found via Tools → <project name> Properties, which is located below the Options menu item. The menu item caption will be different as it includes the project…
Using Custom Functions in Calculated Controls
Custom functions work the same way as MS Access built-in functions such as DateAdd, DatePart and DSum, but are instead created ourselves as database developers. We do this by creating a public function with the VBA programming language and save it inside a global module within the database. Today I am going to explain how custom functions can be…
How to Migrate Data from Access to SQL Server using SSMA (SQL Server Migration Assistant)
SSMA is used to migrate Access databases to SQL Server. This tool converts the Access database to an SQL Server or an SQL Azure database. It is not bundled with SQL Server – you will need to download and install this tool separately. Check your system requirements and view the installation procedure for SSMA. Preparing…
Access Web Apps to be retired
It was announced that Access Services is going to be retired. Details of the announcement may be found here: Updating the Access Services in SharePoint Roadmap. Additional timeline information along with possible methods for exporting your data out of an Access web app may be found here: Access web apps no longer supported. While these articles…