Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Enabling command buttons If....

    I'm trying to disable and enable commands in a dialog box. My dialog has 3 cbo boxes and 3 cmd buttons. I have disabled the print and preview cmd buttons so that the user can't preview or print a report with out making selections in the cbo boxes.
    Ideally I would like to enable the cmd buttons only when all cbo boxes have a selection in them. How would I go about doing this?
    using Access 97
    Thanks all,
    Jols

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Enabling command buttons If....

    Put a routine something like this in your code and call it in the afterupdate event of each combobox:

    <pre>Private Sub TestEnable()
    Dim blnOK As Boolean

    blnOK = True
    If IsNull([cbo1]) Then
    blnOK = false
    End If
    If IsNull([cbo2]) Then
    blnOK = false
    End If
    If IsNull([cbo3]) Then
    blnOK = false
    End If
    [cmdPrint].Enabled = blnOK
    [cmdPreview].Enabled = blnOK
    End Sub </pre>

    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Portland, Maine, USA
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Enabling command buttons If....

    Thanks Charlotte![img]/w3timages/icons/smile.gif[/img]
    Works great!
    If I could only think like you.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Enabling command buttons If....

    What, [img]/w3timages/icons/nuts.gif[/img]? [img]/w3timages/icons/grin.gif[/img]
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •