Results 1 to 7 of 7
  1. #1
    7HikingLeo is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    10

    MS Access 2013 Forms: Skipping questions on a form

    I have created a main form with tabbed subforms. I need to do one last subform (see attached screenshot). If someone selects the Observation check box I want them to answer the Observation question and then skip to the last 3 questions. If they select the Education check box I want them to answer the 2 Education questions then skip to the last 3 questions, etc. I'm new to making forms, however I did get the feel for doing After Update Events and a couple of other code building functions, but I'm stumped on how to go about coding this last subform.
    Attached Thumbnails Attached Thumbnails AccessFormQuestionnaire.PNG  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    One option is to set the textboxes as not visible in the form design then in code set the appropriate controls visible depending on which checkbox is selected.

    Another is to use a tab control and put each category on its own page of the tab control. Then user just needs to click the appropriate page instead of clicking a checkbox. Or you can still have the check boxes (see comment below) on the form and code would set focus to appropriate tab control page.


    Also, probably should use radio buttons in an option group so that only one can be selected, assuming the 3 categories are mutually exclusive.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    I like to use June7's alternate solution. II call it a Wizard style form.

    I have an example templateyou can use. Check out:
    Wizard Form template

    Hope this helps.

  4. #4
    7HikingLeo is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    10
    I created the option group with the 3 selections (Observation, Education, Research). I've made the textboxes invisible. As for: "in code set the appropriate controls visible depending on which checkbox is selected"; I've been unsuccessful. I've been searching and watching YouTube on how to do it, but I'm just not experienced in writing code.

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    With Option Group there are values for each selection, starting with 1. In the OnClick event of the frame control, add the code to make the questions visible or invisible.
    If FrameFieldName=1 Then
    (observation fields visible, all others invisible)
    ElseIf FrameFieldName=2 Then
    ...

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    The If Then Else structure would require referencing each textbox control in each condition to set Visibility to true or false. That means referencing each textbox 3 times.

    Alternative code:

    Me.textboxname.Visible = Me.framename = x

    Use the actual control names and the appropriate value for x. This will set each textbox Visible property to true or false without an If Then Else structure and each textbox is referenced only once although the framename is referenced multiple times. Or set a variable with value of frame and use the variable in each expression.

    intCat = Me.framename
    Me.textboxname.Visible = intCat = x

    Just a matter of preference, pick whichever method you like.
    Last edited by June7; 06-06-2017 at 02:38 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    7HikingLeo is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    10
    Thanks you two SO MUCH! You saved me so much time. Wish I had tried this forum a month ago.

    I tried both ways suggested and they both worked. Here is what ended up using (so darn simple if you know what you're doing):

    Private Sub ProjectUseOptions_Click()
    Me.Observation_Measurements.Visible = Me.ProjectUseOptions = 1
    Me.Education_Activities.Visible = Me.ProjectUseOptions = 2
    Me.Education_NOofVisitors.Visible = Me.ProjectUseOptions = 2
    Me.Research_GPScoordinates.Visible = Me.ProjectUseOptions = 3
    Me.Research_Instrumentation.Visible = Me.ProjectUseOptions = 3
    Me.Research_RNAUniqueness.Visible = Me.ProjectUseOptions = 3
    End Sub

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

Similar Threads

  1. Replies: 1
    Last Post: 09-01-2015, 02:01 PM
  2. Skipping Fields In Forms, Tab Button
    By raffi in forum Forms
    Replies: 2
    Last Post: 04-01-2015, 12:18 PM
  3. Replies: 2
    Last Post: 01-14-2015, 11:44 AM
  4. Replies: 2
    Last Post: 06-13-2011, 09:43 AM
  5. Skipping Fields in forms
    By who in forum Forms
    Replies: 1
    Last Post: 06-17-2009, 12:01 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