• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Adding Code

Programming code for forms is entered into code modules, the same as any other VBA code. With the form present in the Visual Basic Editor, you can (1) use the View...Code menu, (2) right-click the form in the Project Explorer and select View Code, or (3) right-click the form itself and select View Code.

There are several events available for the form and for the controls. The form has Initialize and Terminate events, as well as Activate and Deactivate events. These occur in this order: Initialize, Activate, Deactivate, Terminate. Setup routines can be placed in the Initialize or Activate events, or both. Cleanup routines can be placed in Deactivate or Terminate events, or both. The goal of your development will drive how to apply these. Note that the Deactivate event fires when moving from one user form to another, but not when a form closes.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint