Question Best way to create a dependant field?!?

thekey

New member
Local time
Today, 21:55
Joined
May 1, 2009
Messages
7
Best way to create a dependent field?!?

Hello Users

I was wondering what the best way to create a dependent field in a form was. By way of background I have a subform in which users select one of approx 15 options from a list. If the user selects one option what is the best way to make another field appear so the user can enter more specific data about that option.

For example

Field Name: visit_type (look up from table)
If the pesron selects this I would like two more fields (unique to that selection) to appear e.g. if they select 'Routine check-up' then two more fields appear 'duration' and 'next appt'. These fields should only appear if 'Routine check-up' is selected.

Is this possible? If so can someone point me in the right direction or give me the correct MS Access terminology to search for so I can figure it out.

Thank you in advance.

thekey:D
 
Last edited:
Have 2 textboxes hidden in your form.

Then dependant upon the selection change the "captions" to whatever you want it to be and make them visible when applicable...
 
Hi Mailman

Thank you for your message. I'm not quite sure how to go about doing that, I can add text boxes to forms but not sure how to make them selectively visible. Also where will the data from these text boxes be stored?
 
In code..
Me.YourTextboxName.Visible = True
or
Me.YourTextboxName.Visible = False
will switch visibility.

If these boxes are unbound it will not be stored anywhere, unless you bind them.
Which then stores the data in a table you determain. Or leave them unbound and you have to code the information to be stored someplace.
 
Hi Mailman

I have managed to do this with your help, thanks. The only problem I am having is that my subfrom is in a tabular layout and when I go down to the next line and select another option the dependent fields disappear even though the line previous matches the visibility criteria. Is there a way to keep it visible on the line which fits the criteria and not the lines which don't?
 
if you have a tabular form... no... unfortunatly no...

ALL the visibility options are set to the 'active' or 'current' record...
Perhaps you can do something with conditional formatting.... but not this way...

Sorry to bring bad news :(
 

Users who are viewing this thread

Back
Top Bottom