10.1. VBA Basics

Before you dive into the wonderful world of forms, take a minute to review the following table, which shows the concepts that are fundamental to working with VBA.

ConceptDefinitionExamples
ObjectAn entity that can be manipulated with code
Form, Report, TextBox,
ComboBox, CommandButton,
DoCmd, Debug
MethodAny intrinsic (built-in) functionality already assigned to an object
Form.Requery, Report.Print,
TextBox.SetFocus,
ComboBox.Dropdown,
DoCmd.OpenForm, Debug.Print
EventAn action associated to an object that executes when triggered by the user
Form.Open, Report.NoData,
TextBox.AfterUpdate,
ComboBox.NotInList, CommandButton.Click
PropertyAn attribute of an object that defines its characteristics (such as size, color, or screen location) or an aspect of its behavior (such as whether it is hidden)
Form.BackColor,
TextBox.ControlSource,
ComboBox.RowSource, CommandButton.Picture,
Report.Recordsource

10.1.1. Properties

Forms have properties and so do the controls on a form. Although there are a few properties that can only be read or set in VBA, the majority of an object's properties are listed on the Property Sheet. The main four categories of properties are format, data, event, and other. The needs of the customer and users will dictate which of these properties you set and when. Setting the properties in the Property Sheet may be all that is needed for some; however, the majority of your forms will have some kind of programmatic interaction with the user. Being able to ...

Get Access™ 2007 VBA Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.