Microsoft Access 2010 Bible

(Rick Simeone) #1

Part III: More-Advanced Access Techniques


688


When using subforms within subforms, use the following syntax:

Forms![FormName]![SubformControlName]. _
Form![SubSubformControlName].Form.SubSubFormProperty
Forms![FormName]![SubformControlName]. _
Form![SubSubformControlName].Form.[ControlName]
Forms![FormName]![SubformControlName]. _
Form![SubSubformControlName].Form.[ControlName] _
.ControlProperty

Designing Forms


Following is a grab bag of form design tips that you might find handy. I hope they inspire you to
come up with many more on your own!

Using the Tab Stop property
From time to time, you might place a control on a form that is intended to trigger a fairly drastic
result, such as deleting a record, or printing a long report. If you want to reduce the risk that the
user might activate this control by accident, you might want to make use of the Tab Stop prop-
erty, which specifies whether you can use the Tab key to move the focus to the control.

For example, suppose you’ve placed a command button named cmdDelete on a form that deletes
the current record. You don’t want the user to click this button by mistake. Modify the Tab Stop
property of cmdDelete to No to remove the button from the form’s tab order (the default is Yes).
A user will have to explicitly click on the button to activate it, and the user won’t be able to acci-
dentally choose it while entering data.

Tallying check boxes
If you ever need to count the number of True values in a check-box control, consider using the
following expression:

Sum(Abs([CheckBoxControl]))

Abs converts every –1 to 1, and the Sum function adds them up. To count False values, use the
following expression:

Sum([CheckBoxControl] + 1)

Each True values (–1) is converted to 0 and each False value ( 0 ) is converted to 1 before being
summed.

Adding animation
Using the Timer event, you can pretty simply add animation to Access forms. You can move a
control on the form at quick intervals or rapidly change the appearance of the control. To create
the appearance of animation:
Free download pdf