Professional Documents
Culture Documents
n Module
n a container for related VBA procedures
n subroutine
n function
n each Form object and Report object
can have its own module
n Standard Module objects contain VBA code
independent of a specific form/report
1
Events: Review
n A state, condition, or occurrence on/with a certain object for which
you can define a response
n most events occur as a result of a user action
n e.g.: a mouse click, a key press, navigate to another record
Form Load
Form Current
Form Close
Form BeforeUpdate
2
Creating the Procedures for
the Queries Dialog Box Form
n Used Visual Basic code to make the
Preview and Display buttons come alive
n General Process
n create Visual Basic procedure that
performs the appropriate task(s)
n attach the procedure to the appropriate
event so the code can run when the
event occurs
3
Using an Event Procedure to
Synchronize a Combo Box
n Practice Time
n in issue25.accdb, open frmWritersAndArticles, use the combo box
to navigate to two other writers
n which event was used to provide this functionality?
n what macro action was used to provide this functionality?
n now, use Navigation Buttons to view other writers… watch the
combo box as you do so… it doesn’t change!
n when we navigate to another record on the form, we need to have
the combo box’s value change to match the writer being displayed
n add VBA code to the form’s Current event to set the combo box value
to match the writerid for the writer being displayed
Private Sub Form_Current()
Me.cboToDisplay = Me.WriterID
End Sub
4
Tutorial 12
Securing an Access Database
Database Startup Options
5
Setting Database Startup
Options
n Actions that take place
automatically whenever the
.ACCDB file is opened
n Office Button | Access Options
| Current Database
11