Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Pages Option Button Is Not Available in CommonDialog Control


View products that this article applies to.

This article was previously published under Q207689
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

↑ Back to the top


Symptoms

The Pages option button of the CommonDialog ActiveX control is unavailable when the Flags property is set to cdlPDPageNums.

↑ Back to the top


Cause

This behavior occurs because the default value for Min and Max of the CommonDialog control is 0 when the Flags property is set to cdlPDPageNums. Therefore, you cannot enter a valid page rage in the From and To boxes.

↑ Back to the top


Resolution

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. To resolve this behavior, the Max property of the CommonDialog control needs to be set 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:
1.Follow steps 1 through 6 of the "Steps to Reproduce Behavior" section later in this article.
2.Set the On Click property for the command button 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
					
3.On the View menu, click Form View.
4.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.

↑ Back to the top


More information

Steps to Reproduce Behavior

1.Start Microsoft Access and open any database.
2.Create a new, blank form in Design view, not based on any table or query.
3.On the Insert menu, click ActiveX Control.
4.Select Microsoft Common Dialog Control, version 6.0, and then click OK.
5.Set the Name property of the CommonDialog control to CmnDlg.
6.Add a command button to the form.
7.Set the command button's On Click 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
					
8.On the View menu, click Form View.
9.Click the command button.
Note that the Pages option button and associated edit controls are unavailable, even though the Flags property is set to the cdlPDPageNums constant.

↑ Back to the top


Keywords: KB207689, kbprb

↑ Back to the top

Article Info
Article ID : 207689
Revision : 3
Created on : 6/23/2005
Published on : 6/23/2005
Exists online : False
Views : 282