Difference between revisions of "User:Dec"

From vb24
Jump to navigation Jump to search
(Initial)
 
(More content)
 
Line 1: Line 1:
 
== Access VBA Coding ==
 
== Access VBA Coding ==
 +
 +
=== Database Code Mapping ===
 
* Each table is represented by a class module.
 
* Each table is represented by a class module.
 
* Each field is represented by a property.
 
* Each field is represented by a property.
* The values are stored in a user defined type (value object).
+
* The values are stored in a user defined type (value object), which is usually defined in the class module with a private scope.
* There are three variables for the value object:
+
* There are three variables for different states of the value object:
 
** default (represents an empty object with default values)
 
** default (represents an empty object with default values)
 
** loaded (represents the data from the database)
 
** loaded (represents the data from the database)
 
** current (represents the current data)
 
** current (represents the current data)
 +
* The Id of the object is stored in a private module class variable (mlngId) and also stored in the value object variables, where applicable (loaded and current)
 +
* The Class_Initialize method calls initialize() and reset()
 +
* initialize() creates the default value object and calls reset() in order to populate the default value object
 +
* reset() sets the object Id to zero and assigns the default value object to the loaded and the current
 +
 +
=== CRUD ===
 +
* load()
 +
* create()
 +
* edit()
 +
* view()
 +
* delete()
 +
* save()
 +
* insert()
 +
* update()

Latest revision as of 19:46, 7 August 2016

Access VBA Coding

Database Code Mapping

  • Each table is represented by a class module.
  • Each field is represented by a property.
  • The values are stored in a user defined type (value object), which is usually defined in the class module with a private scope.
  • There are three variables for different states of the value object:
    • default (represents an empty object with default values)
    • loaded (represents the data from the database)
    • current (represents the current data)
  • The Id of the object is stored in a private module class variable (mlngId) and also stored in the value object variables, where applicable (loaded and current)
  • The Class_Initialize method calls initialize() and reset()
  • initialize() creates the default value object and calls reset() in order to populate the default value object
  • reset() sets the object Id to zero and assigns the default value object to the loaded and the current

CRUD

  • load()
  • create()
  • edit()
  • view()
  • delete()
  • save()
  • insert()
  • update()