Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Access VBA Project Context Primer
- ## 1. Data Access Model
- The project uses Microsoft Access native DAO as the primary data access layer.
- Rules:
- - DAO.Recordset and DAO.Database are preferred.
- - ADO is used only where explicitly referenced.
- - QueryDefs represent named queries; SQL strings represent dynamic queries.
- - Bound forms use RecordSource for data binding.
- - Unbound forms use manual DAO to populate controls.
- ## 2. Form Event Model
- Access forms have a strict event order:
- - Load → Open → Current → Activate
- - BeforeUpdate → AfterUpdate are used for validation and saving.
- - Dirty state indicates unsaved changes.
- - Form_Current triggers when navigating between records.
- - Record-level validation occurs in BeforeUpdate.
- ## 3. Bound Form Behavior
- Bound forms automatically:
- - Manage record navigation.
- - Handle locking and concurrency.
- - Commit changes when focus leaves control or DoCmd.RunCommand acCmdSaveRecord.
- - Reject updates in BeforeUpdate via Cancel = True.
- ## 4. Module-Level Structure
- Public functions serve as application-level APIs.
- Private functions are internal helpers.
- Utility modules contain reusable logic such as:
- - Date/time helpers
- - Error handling
- - Validation routines
- - Recordset helpers
- ## 5. Queries
- QueryDefs:
- - Represent stored queries in Access.
- - Often used as templates with parameters or SQL replaced dynamically.
- SQL strings:
- - Used for dynamic filtering, searching, or temporary operations.
- Pass-through queries:
- - Forward SQL directly to the backend DB (if present).
- ## 6. Error Handling Conventions
- The project uses structured error handlers of this form:
- On Error GoTo Err_Handler
- ...
- Exit Function/Exit Sub
- Err_Handler:
- HandleError Err.Number, Err.Description
- ## 7. Naming Conventions
- (Optional: Add your own naming rules)
- - frmSomething = Forms
- - rptSomething = Reports
- - modSomething = Standard modules
- - clsSomething = Classes
- - qdf = QueryDef
- - rs = Recordset
- ## 8. General Environment Notes
- - This is Access Desktop VBA, not VB6 and not .NET.
- - Syntax must follow Access VBA rules.
- - The default database engine is Jet/ACE.
- - No asynchronous operations; all DAO is synchronous.
Advertisement
Add Comment
Please, Sign In to add comment