Setting form properties

Creating a dialog box in Access is similar to creating any other form. You don't even need any VBA code to create the box. Rather, you just create a form and set its Form Properties so that the form looks and acts like a dialog box. Here's how:

1. In the database window, click the Forms button and then click the New button.

2. In the New Form dialog box that opens, choose Design View.

If you created a table for storing settings, choose the table's name from the Choose the Table or Query Where the Object's Data Comes From drop-down list in the New Form dialog box.

If you won't be storing settings in a table, just leave that drop-down list option empty so the form won't be bound to any table.

4. If the Properties sheet isn't visible, choose ViewOProperties or press F4.

5. In the Properties sheet, make sure that Form is selected, and then click the All tab (see Figure 9-4).

El Torml : Form sr

Figure 9-4:

Setting form properties for a dialog box.

Form

Fuirn

Form properties

=.eco-r Source Set trg-;T able

Caption S<jpLa:es

Mow =o-n View ves

Allow Datasheet View Ido_

Allow PivotTable View No

Allow PivotChart View No_

Allow Edits [Yes

Allow Deletions |No_

Allow Additions No__

Data Entry ,

Recordset Type Dynaset

Record Locks ¡No Locks

Scroll Bars Neither

Record Selectors No_

Navigation Buttons No

Dividing Lines ¡No_

Auto Resize Yes

Auto Center Yes

6. Set the properties as indicated in Table 9-3.

7. Save the form.

6. Set the properties as indicated in Table 9-3.

7. Save the form.

Table 9-3 Properties to Make a Form into a Dialog Box

Property

Setting

Reason

Default View

Single Form

To look like a dialog box.

Allow Form View

Yes

To look like a dialog box.

Allow Datasheet View

No

Dialog boxes have no such view.

Allow PivotTable View

No

Dialog boxes have no such view.

Allow PivotChart View

No

Dialog boxes have no such view.

Allow Edits

Yes

User needs to change settings.

Allow Deletions

No

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

(continued)

Table 9-3 (continued)

Properly

Selling

Reason

Allow Additions

No

Underlying table (if any) must contain 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 navigation 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

Looks like a dialog box border.

Control Box

Yes

Needed to make Close button visible.

Min Max Buttons

None

Dialog box can't be sized.

Close Button

Yes

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

Cycle

Current Record

Only one record in underlying settings table.

To color your dialog box, click the Detail band in forms 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 band to 16316664.

To color your dialog box, click the Detail band in forms 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 band to 16316664.

0 0

Post a comment