Download Access VBA Programming For Dummies Feb 2007.pdf PDF

TitleAccess VBA Programming For Dummies Feb 2007.pdf
Tags
LanguageEnglish
File Size9.6 MB
Total Pages411
Document Text Contents
Page 2

by Joseph C. Stockman and Alan Simpson

Access™ 2007 VBA
Programming

FOR

DUMmIES


01_046531 ffirs.qxp 1/16/07 9:07 PM Page iii

Page 205

Table 9-3 (continued)
Property Setting Reason

Allow Filters No Underlying table (if any) has only
one record.

Data Entry No Underlying table (if any) must
contain only one record.

Scroll Bars Neither Dialog boxes don’t have scroll
bars.

Record Selectors No Dialog boxes don’t have record
selectors.

Navigation Buttons No Dialog boxes don’t have naviga-
tion buttons.

Dividing Lines No Dialog boxes don’t need them.

Pop Up Yes Keep dialog box on top of other
open windows.

Modal Yes Disable other open windows until
user responds to dialog box.

Border Style Dialog Make it look like a dialog box
border.

Control Box Yes Need to make Close button
visible.

Min Max Buttons None Dialog box can’t be minimized or
maximized.

Close Button Yes Dialog boxes have a Close button,
which acts like a Cancel button.

Cycle Current Record Only one record is in underlying
settings table.

To color your dialog box, click the Detail section in Design view, click its
Back Color property, and choose a color. For example, for a slightly off-
white color, set the Back Color property of the Detail section to 16316664.

186 Part IV: Applying VBA in the Real World

16_046531 ch09.qxp 1/16/07 9:18 PM Page 186

Page 206

Adding controls to the dialog box
The form properties that you change to control the appearance and behavior
of a form don’t affect how you add controls to the form. You can still use all
the standard techniques that you use in Access to create a form for scrolling
through records. For example, to add a bound control to the form, click a
control type in the Controls group on the (Form Design Tools) Design tab.
Then drag the underlying field’s name from the Field List to the form. To add
an unbound control to the form, click a control type in the Toolbox and then
click the form’s Design grid.

If the Control Wizard opens after you drop a control on the form, you can
step through the wizard as you normally would. If you’re planning to attach
custom code to the control later and don’t want the wizard to create the con-
trol, just click the wizard’s Cancel button. Then you can assign a name, a cap-
tion, and some events to the control by using the control’s property sheet.

For example, the top half of Figure 9-5 shows in Design view a sample dialog
box with four main controls: ReportName, LabelsToSkip, CancelBttn,
and PrintBttn. In that example, the controls ReportName and
LabelsToSkip are bound to fields in the SettingsTable described earlier
in this section. Thus, the dialog box remembers the settings in those controls
from one session to the next. The lower half of Figure 9-5 shows the same
form open in Form view.

Figure 9-5:
Controls

on a form
(dialog box).

187Chapter 9: Creating Your Own Dialog Boxes

16_046531 ch09.qxp 1/16/07 9:18 PM Page 187

Page 410

Available wherever books are sold. For more information or to order direct: U.S. customers visit www.dummies.com or call 1-877-762-2974.
U.K. customers visit www.wileyeurope.com or call 0800 243407. Canadian customers visit www.wiley.ca or call 1-800-567-4797.

Get smart @ dummies.com®
• Find a full list of Dummies titles

• Look into loads of FREE on-site articles

• Sign up for FREE eTips e-mailed to you weekly

• See what other products carry the Dummies name

• Shop directly from the Dummies bookstore

• Enter to win new prizes every month!

Also available:
Bipolar Disorder For Dummies
0-7645-8451-0
Chemotherapy and Radiation
For Dummies
0-7645-7832-4
Controlling Cholesterol For Dummies
0-7645-5440-9
Diabetes For Dummies
0-7645-6820-5* †
Divorce For Dummies
0-7645-8417-0 †

Fibromyalgia For Dummies
0-7645-5441-7
Low-Calorie Dieting For Dummies
0-7645-9905-4
Meditation For Dummies
0-471-77774-9
Osteoporosis For Dummies
0-7645-7621-6
Overcoming Anxiety For Dummies
0-7645-5447-6
Reiki For Dummies
0-7645-9907-0
Stress Management For Dummies
0-7645-5144-2

HEALTH & SELF-HELP

0-7645-8450-2 0-7645-4149-8

Also available:
The ACT For Dummies
0-7645-9652-7
Algebra For Dummies
0-7645-5325-9
Algebra Workbook For Dummies
0-7645-8467-7
Astronomy For Dummies
0-7645-8465-0
Calculus For Dummies
0-7645-2498-4
Chemistry For Dummies
0-7645-5430-1
Forensics For Dummies
0-7645-5580-4

Freemasons For Dummies
0-7645-9796-5
French For Dummies
0-7645-5193-0
Geometry For Dummies
0-7645-5324-0
Organic Chemistry I For Dummies
0-7645-6902-3
The SAT I For Dummies
0-7645-7193-1
Spanish For Dummies
0-7645-5194-9
Statistics For Dummies
0-7645-5423-9

EDUCATION, HISTORY, REFERENCE & TEST PREPARATION

0-7645-8381-6 0-7645-9554-7

* Separate Canadian edition also available
† Separate U.K. edition also available

27_046531 bob.qxp 1/16/07 9:23 PM Page 391

Page 411

Check out the Dummies Specialty Shop at www.dummies.com for more information!

Do More with Dum
mies

Instructional DVDs • Music Compilations
Games & Novelties • Culinary Kits
Crafts & Sewing Patterns
Home Improvement/DIY Kits • and more!

27_046531 bob.qxp 1/16/07 9:23 PM Page 392

Similer Documents