ACC: Can't Enable Pages Option Button in CommonDialog ControlID: Q174002
|
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.
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:
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
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.
Private Sub Command1_Click()
Dim cd As CommonDialog
Set cd = Me!CmnDlg.Object
' Enable Pages option button.
cd.Flags = cdlPDPageNums
cd.ShowPrinter
End Sub
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
Last Reviewed: April 26, 1999