Results 1 to 4 of 4
  1. #1
    oldlearner is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2015
    Posts
    31

    Best way to navigate to a specific questionnaire depending on choice selected

    I have a database that allows a person to select a medical condition. Depending on condition selected from a list I want to navigate to a questionnaire specific to the condition. for example selecting "heart condition" from a list would divert to a different questionnaire to someone selecting "mental health" conditions.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You have a form for each questionnaire? Use code (macro or VBA) to open desired form. Fairly simple If the combobox lists the exact form names.

    DoCmd.OpenForm Me.cboQuestionnaire

    Attempt code and when you encounter specific issue post question.
    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
    oldlearner is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Sep 2015
    Posts
    31
    Quote Originally Posted by June7 View Post
    You have a form for each questionnaire? Use code (macro or VBA) to open desired form. Fairly simple If the combobox lists the exact form names.

    DoCmd.OpenForm Me.cboQuestionnaire

    Attempt code and when you encounter specific issue post question.
    Thanks for the reply June. To be more Specific- I have a form "FrmPersonal", Which has personal details and a Field "Primary Condition" This Field has a dropdown list with a choice of "Heart Condition", "Mental Health" etc. in the list. I also have different questionnaires for each condition "FrmParQ1" "FrmParQ2" etc.. If I select Heart Condition from the list I want it to cascade to FrmParQ1 If I select Mental Health I want it to Cascade to FrmParQ2.
    Do I need to go to the field properties and apply a macro to on the on click event that differentiates where to cascade depending on the selection made? Many thanks for taking the time to reply, much appreciated.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    If the form name is not available in the combobox then need conditional code. I don't use macros, only VBA, like:
    Code:
    Dim strForm As String
    Select Case Me.cboCondition
       Case "Heart Condition"
          strForm = "1"
       Case "Mental Health"
          strForm = "2"
    End Select
    DoCmd.OpenForm "FrmParQ" & strForm
    If the combobox has the form number suffix in a column, say column 2, the code can be simply:

    DoCmd.OpenForm "FrmParQ" & Me.cboCondition.Column(1)
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 11-16-2016, 11:10 AM
  2. Replies: 1
    Last Post: 03-03-2016, 05:23 PM
  3. Replies: 8
    Last Post: 02-25-2016, 10:20 AM
  4. Replies: 2
    Last Post: 03-11-2015, 07:45 AM
  5. Visible text boxes when combo box choice selected
    By nichmeg in forum Programming
    Replies: 3
    Last Post: 10-16-2011, 02:53 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