Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    11

    Unanswered: Help with Enabling a Button from a Combo Box

    Hi,

    I am wondering if someone can help me enable a command button when a specific item is selected from a combo box.

    I have a combo box on a form (expeditefrm) called “cboSerType” and have two items in the list; “Standard” and “Other Services”. I also have a command button called “cmdbuttonNotes” and would like the button to be in a disable state as a default. The button should be enabled with the item “Other Services” is selected from the combo box (cboSerType).

    Any assistance will be greatly appreciated.

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    To set Enabled/Disabled on selection from the combobox
    Code:
    Private Sub cboSerType_AfterUpdate()
     If cboSerType = "Other Services" Then
      cmdbuttonNotes.Enabled = True
     Else
      cmdbuttonNotes.Enabled = False
     End If
    End Sub
    To persisit the state when moving from record to record
    Code:
    Private Sub Form_Current()
    If cboSerType = "Other Services" Then
      cmdbuttonNotes.Enabled = True
     Else
      cmdbuttonNotes.Enabled = False
     End If
    End Sub
    cboSerType has to be bound to a field in the underlying table. There's no need to set the command button to Disabled; the code in the Form_Current event takes care of that.
    Last edited by Missinglinq; 04-02-09 at 22:32.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Apr 2009
    Posts
    11
    It works perfect!!!!

    Thank you so much Missinglinq. :-)

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad it works for you!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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