Results 1 to 5 of 5
  1. #1
    Hello World is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2011
    Posts
    13

    Command Buttons - Hiding/Unhiding

    Hi all,



    In Access 2002 I have 6 buttons on my non continuous form. Their names being:

    1. Yes
    2. No
    3. FormLeftBlank
    4. DefacedForm
    5. IlegibleForm
    6. NoSignature

    I also have a combobox on my form with the six values inside it being (notice the spaces):

    1. Yes
    2. No
    3. Form Left Blank
    4. Defaced Form
    5. Ilegible Form
    6. No Signature

    What I require is that when the value in the combo box is chosen then the approriate command button becomes visible (and all the others stay hidden). I.e. If the user chooses the 'Yes' value in the combo box then the 'Yes' command button appears. I need this for all six values in the combobox.

    Can anyone help?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You would simply use code in the AfterUpdate event of the ComboBox.

  3. #3
    Hello World is offline Novice
    Windows XP Access 2002
    Join Date
    Sep 2011
    Posts
    13
    Hi RG,

    I tried this but I didn't know how to create the code to cover all the permutations?

    Code:
    Private Sub Answer_AfterUpdate()
       If Answer.Text = "Yes" Then
          Yes.Visible = False
          No.Visible = True
       Else
          Yes.Visible = True
          No.Visible = False
       End If
    End Sub
    Last edited by Hello World; 10-10-2011 at 07:36 AM. Reason: clarity

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Start here:
    Code:
    Me.Yes.Visible = False
    Me.No.Visible = False
    Me.FormLeftBlank.Visible = False
    Me.DefacedForm.Visible = False
    Me.IlegibleForm.Visible = False
    Me.NoSignature.Visible = False
    Select Case Me.Answer
       Case "Yes"
          Me.Yes.Visible = True
       Case "No"
          Me.No.Visible = True
       ...
    End Select

  5. #5
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by Hello World View Post
    Hi all,

    In Access 2002 I have 6 buttons on my non continuous form. Their names being:

    1. Yes
    2. No
    3. FormLeftBlank
    4. DefacedForm
    5. IlegibleForm
    6. NoSignature

    I also have a combobox on my form with the six values inside it being (notice the spaces):

    1. Yes
    2. No
    3. Form Left Blank
    4. Defaced Form
    5. Ilegible Form
    6. No Signature

    What I require is that when the value in the combo box is chosen then the approriate command button becomes visible (and all the others stay hidden). I.e. If the user chooses the 'Yes' value in the combo box then the 'Yes' command button appears. I need this for all six values in the combobox.

    Can anyone help?
    Put this in the after update event of the combo box:

    Code:
     
    Select case Me.YourComboBoxName
    Case "Yes"
    Me.[Yes].Visible=True
    Me.[No].Visible=False
    Me.FormLeftBlank.Visible=False
    Me.DefacedForm.Visible=False
    Me.IlegibleForm.Visible=False
    Me.NoSignatureVisible=False
    Case "No"
    Me.[Yes].Visible=False
    Me.[No].Visible=True
    Me.FormLeftBlank.Visible=False
    Me.DefacedForm.Visible=False
    Me.IlegibleForm.Visible=False
    Me.NoSignatureVisible=False
    Case "Form Left Blank"
    Me.[Yes].Visible=false
    Me.[No].Visible=False
    Me.FormLeftBlank.Visible=True
    Me.DefacedForm.Visible=False
    Me.IlegibleForm.Visible=False
    Me.NoSignatureVisible=False
    Case "Defaced Form"
    Me.[Yes].Visible=False
    Me.[No].Visible=False
    Me.FormLeftBlank.Visible=False
    Me.DefacedForm.Visible=True
    Me.IlegibleForm.Visible=False
    Me.NoSignatureVisible=False
    Case "Ilegible Form"
    Me.[Yes].Visible=False
    Me.[No].Visible=False
    Me.FormLeftBlank.Visible=False
    Me.DefacedForm.Visible=False
    Me.IlegibleForm.Visible=True
    Me.NoSignatureVisible=False
    Case "No Signature"
    Me.[Yes].Visible=False
    Me.[No].Visible=False
    Me.FormLeftBlank.Visible=False
    Me.DefacedForm.Visible=False
    Me.IlegibleForm.Visible=False
    Me.NoSignatureVisible=True
    End Select

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Command Buttons
    By BLD21 in forum Access
    Replies: 2
    Last Post: 05-10-2011, 06:27 AM
  2. Command Buttons
    By Rosier75 in forum Access
    Replies: 3
    Last Post: 03-09-2011, 11:59 AM
  3. command buttons
    By nashr1928 in forum Forms
    Replies: 23
    Last Post: 10-15-2010, 04:09 PM
  4. Command buttons
    By maintt in forum Forms
    Replies: 3
    Last Post: 08-03-2010, 09:52 AM
  5. Moving Command Buttons
    By Pete Cope in forum Forms
    Replies: 0
    Last Post: 03-23-2010, 03:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums