ACC: Can't Enable Pages Option Button in CommonDialog Control
ID: Q174002
|
The information in this article applies to:
-
Microsoft Access 97
-
Microsoft Office Developer Edition 97
SYMPTOMS
Advanced: Requires expert coding, interoperability, and multiuser skills.
The Pages option button of the CommonDialog ActiveX control remains
disabled when you set the Flags property to the cdlPDPageNums constant.
RESOLUTION
You must set the Max property of the CommonDialog control to a value
greater than 0, and greater than the value of the control's Min property.
To enable the Pages option button, follow these steps:
- Follow steps 1 through 6 of the "Steps to Reproduce" Section later in
this article.
- Set the command button's OnClick property to the following event
procedure:
Private Sub Command1_Click()
Dim cd As CommonDialog
Set cd = Me!CmnDlg.Object
With cd
.Flags = cdlPDPageNums
' Allow a page range of 1 - 50 to be entered in
' the dialog box.
.Min = 1
.Max = 50
' Default the From box to 1, and the To box to 50.
' Note that the FromPage property must be greater than or
' equal to the Min property, and the ToPage property
' must be less than or equal to the Max property.
.FromPage = 1
.ToPage = 50
.ShowPrinter
End With
End Sub
- Open the form in Form view.
- Click the command button.
Note that the Pages option button and associated edit controls are
enabled, and the page range is set from 1 to 50 by default.
MORE INFORMATION
The Flags property of the CommonDialog control allows you to specify the
cdlPDPageNums constant to enable the Pages option button and associated
edit controls. However, because the default value for both the Min and Max
properties of the CommonDialog control is 0, the user cannot enter a valid
page range in the From and To boxes. Therefore, your code must
automatically set the Max property to a value greater than the Min
property.
Steps to Reproduce Behavior
- Open the sample database Northwind.mdb.
- Open a new, blank form in Design view.
- On the Insert menu, click ActiveX Control.
- Select Microsoft Common Dialog Control, version 5.0, and then click
OK.
- Set the Name property of the CommonDialog control to "CmnDlg."
- Add a command button to the form.
- Set the command button's OnClick property to the following event
procedure:
Private Sub Command1_Click()
Dim cd As CommonDialog
Set cd = Me!CmnDlg.Object
' Enable Pages option button.
cd.Flags = cdlPDPageNums
cd.ShowPrinter
End Sub
- Open the form in Form view.
- Click the command button.
Note that the Pages option button and associated edit controls are
disabled, even though the Flags property is set to the cdlPDPageNums
constant.
REFERENCES
For more information about the Common Dialog control, search the Help Index
for "CommonDialog control," or ask the Microsoft Access 97 Office
Assistant.
For more information about using the Max property with the Common Dialog
control, search for "Max property," and then "Max, Min Properties
(CommonDialog)" using the Help Index.
Additional query words:
prb custom
Keywords : OdeGen
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb