User:Dec

From vb24
Jump to navigation Jump to search

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()