Results 1 to 8 of 8
  1. #1
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101

    Arranging a dependent field in a form

    I have a list of questions and sub-questions in a form.

    e.g. Are you above 40 years of age? Yes/No
    If the answer for this is yes, then another sub-question has to be answered. If the answer is no, this sub-question need not be answered.

    I have arranged all of them (both the question and sub-question) in a tabular format.
    But it is a bit confusing for the user, as questions which have to be answered and which may have to be skipped occur sequentially.



    What is the best way to display them in a form.

    The options seem to be:
    1) Remove them from the tabular layout and manually and keep the sub-question below the main question just like a indented bullet list.
    2) Make the sub-question appear in the form only if the main question is answered yes. Is it possible?

    Please advise me if a better method is available.

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    I would opt for number 2 and use the after update event to disclose the sub question. Set all sub questions to hidden in the On load event for the form.

  3. #3
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    Can you please share the code for hiding the sub-question controls here. Thanks!

  4. #4
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    I tried this, but it did not work:

    Code:
    Private Sub Form_Current()
    If Me!ComboBox.1 = "Yes" Then
    Me!ComboBox2.Visible = True
    Else
    Me!ComboBox2.Visible = False
    End If
    
    
    End Sub

  5. #5
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    Tried the above code after replacing the first line with:
    Code:
     Private Sub ComboBox.1_AfterUpdate()
    Still not working.

  6. #6
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    I found a decent workaround for this!

    First disable the sub-question control. Then, use 'Conditional formatting' to enable it if the answer to the main question is "Yes".

  7. #7
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 10 Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,538
    Glad you got it working.

  8. #8
    Bradex is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2011
    Posts
    101
    Thanks for your guidance!

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

Similar Threads

  1. Arranging Data and Logic
    By IAFerrari in forum Forms
    Replies: 1
    Last Post: 10-20-2015, 08:23 AM
  2. Replies: 1
    Last Post: 09-25-2015, 09:05 AM
  3. Excel Query data re-arranging.
    By tc197 in forum Queries
    Replies: 2
    Last Post: 08-20-2014, 07:59 AM
  4. Replies: 18
    Last Post: 10-25-2012, 10:57 PM
  5. Replies: 4
    Last Post: 02-08-2011, 08:43 AM

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