ACC2000: Pages Option Button Is Not Available in CommonDialog Control (207689)



The information in this article applies to:

  • Microsoft Access 2000

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).

SYMPTOMS

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

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.

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.

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.

Modification Type:MajorLast Reviewed:6/23/2005
Keywords:kbprb KB207689