MS Access Forms: conditional sections in a form

Anonymous
2022-06-12T05:18:05+00:00

Is there a way you can display a series of question conditional to a previous answer? HOw?

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2022-06-15T04:20:02+00:00

    Would be useful to provide an example of what you are trying to do, as there could be many ways to address this.

    If for example, you have a fixed number of questions to be answered and you want to stop the user from answering later questions until they've answered an earlier question, then you can initialise all but the first answer input fields as hidden (visible = false) or disabled (enabled = false). When the user has provided a value for the first answer then you unhide or enable the next question in sequence.

    You might also want to lock a previously entered answer (locked = true) and provide a mechanism for the user to go back to earlier answers to revise them (if required).

    Brett

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-06-12T10:52:09+00:00

    You would need to create a relationship between the Questions and Answers tables.  The relationship type could be one-to-many, in which case you would simply need an AnswerID foreign key column in Questions, or it could be many-to-many, in which case the relationship type would be modelled by a table which resolves it into two one-to-many relationship types:

    NextQuestions

    .....AnswerID  (FK)

    ….QuestionID  (FK)

    The primary key would be a composite of the two foreign keys.

    You can then reference the previous answer as a parameter in the RecordSource of a form, subform, or list box, whichever way you wish to display the questions.  The form, subform, or list box would be requeried in the Answer control’s AfterUpdate event procedure.

    Was this answer helpful?

    0 comments No comments