Read an Excerpt
Chapter 2: Access Programming Techniques
Another value you can set this property to is All Records. This basically locks the entire table from anyone else editing, adding, or deleting records in the underlying table. The lock is released when the form is closed.A less restrictive locking can be achieved by setting the property to Edited Records. This locks a page of records when any field is edited, which prevents another person from editing the record currently being worked on. A page in Access is 4,000 bytes of data. So, if each of your records are 1,000 bytes, locking one page or editing one record actually locks four records.
Record Selectors, Navigation Buttons, and Dividing Lines Properties
You can control the look of the form through the Record Selectors, Navigation Buttons, and Dividing Lines properties. If you set the Record Selectors property to No, the user does not see the bar to the left of a record that enables them to highlight an entire record. If you set the Navigation Buttons property to No, the user does not see the arrows at the bottom of the form that enable them to scroll through the records. The purpose of the Dividing Lines properties is to determine whether you see the lines between the form and the navigation section.
For most of the forms in the sample databases in this book, the Record Selectors and Dividing Lines properties are set to No. If you are using a form as a dialog form that does not directly link to the fields in the database, you set the Navigation Buttons property to No.
Report Properties
This section examines some helpful and lesser-known properties of a report that are different from those reviewed inthe Form Properties section. As with a form, you view the properties of a report by right-clicking on the small box in the upper-left corner of the report in Design view.
Page Header and Page Footer Properties
The Page Header and Page Footer properties are used to indicate whether or not to display the header and footer sections on a report. By default, the property is set to All Pages. This prints the section on all the pages of a report. If you set the property to Not with Rpt Hdr, the section is not printed on the page that the report header is printed. If you set the property to Not with Rpt Ftr, then the section is not displayed on the page that the report footer is displayed. If you set the property to Not with Rpt Hdr/Ftr, the section is not displayed on the page where the report header or the report footer is displayed.
Force New Page
Some of the sections of a report have a property called Force New Page. This property is used to indicate the layout action around the section of the report. The default for this property is None, which does not force any page breaks before or after the section prints. If you set the property to Before Section, however, a new page of the report appears before the section. If you set the property to After Section, a new page appears in the report after the section. You can also set the property to Before & After, which forces a new page before and after the section of the report.
Control Properties
This section reviews some of the properties of the common controls that you can add to your form through the Toolbox. To view the properties of a control while in Design view of a form or report, right-click on the Control and Select properties. Note that most of these properties are only available for some of the controls.
Control Source Property
Most of the controls that you add to a form or report can be bound to a field in the underlying table of the form or report. When it is said that a field is bound, that means that the field displays the data for a field in the database. As the user changes that data, the underlying fields are updated. The Control Source property is used to determine which field the control will display.
Status Bar Text Property
Sometimes the field name or the field caption does not tell the user enough information about the field for him or her to be able to enter the data correctly. You can provide the user with more information, however, through the Status Bar Text property. Whatever text you place in this property is displayed in the status bar when the field has the focus.
Enter Key Behavior
Based on the type of field, you may want the Enter key to take one action or another. For example, when the user presses the Enter key in a field such as a First Name, you want the focus to move to the next field such as the Last Name field. In a field like Notes or Comments, however, you may want an Enter key to display a new line.
You can set this behavior through the Enter Key Behavior property. If the property is set to Default, then Access uses the default Access behavior for the field. Typically, it moves it on to the next field on the form. If you set the property to New Line in Field, a new line is added at the point the Enter key is pressed in the field.
Enabled and Locked Properties
The Enabled and Locked properties control the data changes that can be made to the data in the control. By default, Enabled is set to Yes and Locked is set to No, which enables the user to edit the data in a field.
If Enabled is changed to No, the data in the field is still displayed, but it is grayed out and the user cannot highlight the text. If the Locked property is set to Yes, the data is not grayed out, but it still cannot be edited. The user can, though, highlight and copy the locked text.
Tab Stop and Tab Index Properties
Typically, when a user works with your form, he or she uses the Tab key to move from field to field. The order that dictates where the user goes as they tab from field to field is referred to as the Tab Order. You can easily modify this order through the Tab Order dialog displayed in Figure 2-6.
You can select this dialog through the View menu. The dialog enables you to drag and drop the order in which a field occurs in the Tab Order list.
You can also control this behavior through the Tab Stop and Tab Index properties. First, remove a control from the Tab Order by setting the Tab Stop property to No. The Tab Index property is used to indicate the order in which the control appears in the Tab Order.
ControlTip Text
Many programs use a device that displays a yellow box that displays some brief text when a user moves the cursor over a field. That box is sometimes called Balloon Help, Tool Tip Text, or, in Access, ControlTip Text. Whatever text you place in this property is displayed when the user hovers the cursor over the control...