Share this Page URL

Chapter 1. The HelloWorld Database > Using Events and Code - Pg. 25

The HelloWorld Database 25 In the Visual Basic Editor, at the bottom of the panes on the left, notice that here, too, you see a list of properties. The large pane on the right side (known as the code window ) is the area in which you enter program code. The name of the command button (cmdDisplayGreetings) and the name of the event (Click) are selected in the lists at the top. The Visual Basic Editor has created a programming element known as a Sub procedure for the code you'll add by including the following code statements: Private Sub cmdDisplayGreetings_Click() End Sub 5. You'll learn about Sub procedures in Chapter 5. For now, you can recognize that these state- ments refer to the button we added and to what will happen when the button is clicked. In the blank line above the End Sub statement, type the following: DoCmd. As you type the period after DoCmd (which you can think of as an abbreviation for Do Com- mand), you'll see a menu pop up, as shown below, with a list of possible actions. This menu is one of the ways in which the Visual Basic Editor provides information that helps you write code. This menu, part of a feature known as Microsoft IntelliSense, recognizes the context you're working in and displays relevant information. You'll see other examples of IntelliSense in Chapter 5. 6. Scroll down the list of commands, and when you locate OpenReport, double-click it. You'll see that OpenReport is added to the DoCmd statement, as shown here: