Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access: Conditional Form Widgets

Status
Not open for further replies.

mattsv

Programmer
May 21, 2005
28
US
Hello,

I have a question. I have some checkboxes a user clicks to answer some questions in an Access Form.

When a user clicks certain checkboxes (or rather they tell the computer "Yes- This condition applies!") I want to display additional checkboxes relevant to that checkbox (kind of like sub questions to that particular question).

If the checkbox is not clicked, I don't want to display sub questions.

Any ideas on what's best to do to do this?
 
Have a look at the Visible property of a form's control.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

An example
Private Sub EXPCHG_Change()
If EXPCHG = "YES" Then
MESSCHG.Visible = True
LONDONMAN.Visible = True
REPEXP.Visible = True
AUTHORISEDSIG.Visible = True
Else: MESSCHG.Visible = False
LONDONMAN.Visible = False
REPEXP.Visible = False
AUTHORISEDSIG.Visible = False
End If

End Sub
 
How are ya mattsv . . . . .

Is this schema to be [blue]cascading in nature[/blue] . . . that is, [blue]will the selections go several levels deep?[/blue]

Example:
[ol][li]A selection makes 2 others visible.[/li]
[li]Of the two above, one selects three others . . . and so on.[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
mattsv . . . . .

Correcting my example (its misleading)
[ol][li]A selection makes 2 others visible.[/li]
[li]Of the two above, one makes others visible . . . and so on.[/li][/ol]

Calvin.gif
See Ya! . . . . . .
 
I haven't at the moment needed to do multiple sublevels, however, TheAceMan1, I think that's something that will probably happen.

How do you go about multiple sublevels to one question thread?
 
mattsv . . . . .

Well . . . that could get into quite a bit of programming (very time consuming . . . testing & all).

As one learned in your business & present DB application, at a maximum . . . best guess . . . [purple]how deep would you expect levels to go (go for the higher level +1)?[/purple]

[blue][purple]Unkown[/purple] . . . is an aceptable answer . . .[/blue]

Calvin.gif
See Ya! . . . . . .
 
I was hoping there was some way Access supported doing such things- especially when trying to simplify the effort and overhead required to populate a database for the people doing data entry.

That way, I could just write questions that data entry people respond to and conditionally provide questions asking for elaboration of branch possibilities.
 
[blue]I was hoping there was some way Access supported doing such things- [purple]especially when trying to simplify the effort and overhead required to populate a database for the people doing data entry.[/purple][/blue]
There ia a way provided by Access. [purple]Its called programming![/purple] It'll take a little more than expected . . . [blue]but can be done![/blue]

If your sharp (as you appear to be!) . . . you'll see, [purple]I'm just pulling info to determine how to setup the code![/purple]

Why! . . . if a user selects a parent checkbox as false, not only do you want to set all children to hidden on all child levels, but their values need to be set to [blue]False[/blue], on all Child Levels!

[purple]So! . . . your answer to my question in my previous post is?[/purple]

Calvin.gif
See Ya! . . . . . .
 
Well, I think to be safe it is best to say the number of levels is unknown. I think often there will be 2-3 levels.

I think I found how to do this: I just made events trigger on AfterUpdate(). When conditions are met, it hides or shows questions which follow in response to that question's response.

I don't modify the values entered in the sublevels if the main question goes from "applies" to "doesn't apply". This is because it's possible users may accidentally select the wrong checkbox and should be able to unroll their changes quick and easily.


I was hoping/wondering if Access had some wizard to help people make these sort of decision trees within Access Forms. I mean, it really would reduce the amount of information presented to those in data entry... sort of to reduce information overload.

Thanks Ace. This is really easy to do, I was just trying to inquire if a wizard or third party component is out there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top