Difference between revisions of "Microsoft Access VBA Coding Conventions"

From database24
Jump to navigation Jump to search
(Created page with '== General == === Indentation === The indentation size is 4. === Empty lines === === Variables === * Early binding * No globals * No abbreviations * Make use of the variable t...')
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Microsoft Access]]
 +
[[Category:VBA]]
 +
[[Category:Conventions]]
 
== General ==
 
== General ==
 +
In general please refer to the [http://wiki.vb24.net/index.php/Coding_Conventions Visual Basic Coding Convenstions].
 +
 +
== Architecture ==
 +
Access database applications should always be split up into a frontend and a backend.
 +
 +
The frontend contains
 +
* Tables
 +
** Links to backend tables
 +
** Temporary tables
 +
* Queries
 +
* Forms
 +
* Reports
 +
* Macros
 +
* Code
 +
 +
The backend contains
 +
* Tables
 +
 +
=== Multi User Environment ===
 +
In a multi user environment, the frontend is usually copied to the local hard drive,
 +
while the backend resides on a file server.
 +
 +
Temporary frontend tables must be prefixed properly and must be suffixed per user.
 +
While it is not recommended to leave the frontend on a file server, there are still
 +
scenarios, where concurrent frontend accesses could happen—and in this case
 +
the functionality of the database has to be ensured.
 +
  
 
=== Indentation ===
 
=== Indentation ===

Latest revision as of 15:57, 29 November 2011

General

In general please refer to the Visual Basic Coding Convenstions.

Architecture

Access database applications should always be split up into a frontend and a backend.

The frontend contains

  • Tables
    • Links to backend tables
    • Temporary tables
  • Queries
  • Forms
  • Reports
  • Macros
  • Code

The backend contains

  • Tables

Multi User Environment

In a multi user environment, the frontend is usually copied to the local hard drive, while the backend resides on a file server.

Temporary frontend tables must be prefixed properly and must be suffixed per user. While it is not recommended to leave the frontend on a file server, there are still scenarios, where concurrent frontend accesses could happen—and in this case the functionality of the database has to be ensured.


Indentation

The indentation size is 4.

Empty lines

Variables

  • Early binding
  • No globals
  • No abbreviations
  • Make use of the variable type prefix

Access Classes

Forms

  • Group
    • Form event procedures
    • From control event procedures
    • Methods

Reports

Function

Name

The function name starts with a verb in lower case.

Result

The result variable is declared as first variable and the result assignment is the last statement in every function.

Conditions

  • If, ElseIf, Else, End If

Loops

  • Do Loop
  • Not: While Wend

Classes