Results 1 to 6 of 6
  1. #1
    jeepxj3 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    3

    Hide ComboBox until other ComboBox is populated

    I have been searching all over for a solution to this, and thought cascading comboboxes was the answer to my issue however it does not work how I would like for it to. Let me first explain what I am looking to do.



    I have a combobox "Treatment1" you must select a treatment from the drop down, only after this field is populated, would I like for combobox "Treatment2" to be displayed, and so forth. I was able to hide the field by inserting the following code into my form as well as combobox however I cannot get it to display itself once an option for "Treatment1" is chosen.

    Here is an example of my code:
    Private Sub Form_Load()
    'This code will hide the named text box until a selection has been made in your Combo, assuming that it does not have a default value
    If IsNull(Me.ComboTreatment1) Then
    Me.ComboTreatment1.Visible = False
    Else
    Me.ComboTreatment2.Visible = True
    End If
    End Sub

    Thanks for your help!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Is Treatment2 dependent on the Value selected in treatment1?

  3. #3
    jeepxj3 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    3
    Quote Originally Posted by orange View Post
    Is Treatment2 dependent on the Value selected in treatment1?
    Yes, you must fill in "Treatment1" before "Treatment2" is available. (hope this helps)

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    What part of cascading combo doesn't apply? I'm quite sure you could make treatment2 visible once treatment1 is selected..

  5. #5
    jeepxj3 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Posts
    3
    Quote Originally Posted by orange View Post
    What part of cascading combo doesn't apply? I'm quite sure you could make treatment2 visible once treatment1 is selected..
    I dont want the combobox2 to display at all until combobox1 or "Treatment1" is chosen.

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    So on your form Load event set treatment2 visible = False
    and when treatment1 is selected, make treatment2 visbile = true, and adjust the
    record source to use the value selected in treatment1.

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

Similar Threads

  1. Replies: 29
    Last Post: 08-16-2011, 05:52 PM
  2. Replies: 6
    Last Post: 07-28-2011, 04:07 AM
  3. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  4. Please I need help with combobox
    By em12 in forum Access
    Replies: 1
    Last Post: 07-16-2010, 08:04 AM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 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