Is it possible to Hide a text box on a form depending on the selec

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with multiple combo boxs, where the user selects one of five
options, for three of the options the user then needs to enter information on
another form. It would make the second form more user friendly if only the
text boxs that were relevant were displayed and better still if they were
grouped together to make the form look tidier. Any help?
Thanks in advance.
 
I tried this before.
Firstly, I set the text box, property-->Data--> Enable = no, then the text
box becomes dim up.

Secondly, setup the comob box, name it, e.g opt
In the combo box, create an After Update event, build a macro with condition
view
assuming that your option in the combo box are "a", "b", "c", "d", "e"

Condition:[opt]="c", action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = yes
the other conditions, action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = no

Bobocat
 
It's pretty difficult to offer any real help with the limited information
that you have provided. However, you might want to look into opening your
second form using the DoCmd.OpenForm method and supplying an optional OpenArg
parameter. The second form can be made to respond accordingly based on the
argument that you pass in.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Hi,

If I understand you have one form containing combo boxes and depending upon
the selections made in these boxes you may wish to open another form and that
second form may also differ in content and format from one choice to another.
From your posting name I also conclude you do not have too much opinion of
your Access skills - or are you being modest?

Yes, it's possible to do what you want and there are numerous ways you can
achieve it. Personally I would get behind the scenes and use VBA to
manipulate my second form but I will avoid VBA as much as possible in this
reply. Moreover unless circumstances dictated otherwise I would make that
second form a sub form on the main form.

OK, manipulating the properties of controls on a form is straightforward but
I would advise against trying to move controls around. There are two
simplistic approaches you can take. Either design a different form for each
case and open the appropriate one depending upon the selection in the combo
boxes or design one form with generalised text boxes and resolve the
visibility, bindings and captions of each text box as it is loaded. In the
second case consider using the OpenArgs property to instuct the second form
as to what format it should take. You then need to put code behind the Load
event.

There are some logistic considerations too. What happens when the user is
finished with the second form? Is it closed? (Hopefully it is or you will
end up with unsychronised data being displayed.) When the second form is
closed what happens to the first form, etc.? I assume also you need to
synchronise the first and second forms with respect to one DB record or one
query result set row - do you use the filter clause of the DoCmd OpenForm
function?

Hope this at least points you in the right direction. When you have decided
on a few specifics I and others can be more specific in our responses.

Regards,

Rod
 
Rod you understand perfectly, and my access skills are limited although i
have done some work with vba. I'll set off in the direction you say and see
how i get on.
Thanks
ian
 
Rod you understand perfectly, and my access skills are limited although i
have done some work with vba. I'll set off in the direction you say and see
how i get on.
Thanks
ian
 
This also sounds a good method I'll try this one too thanks
Ian

bobocat said:
I tried this before.
Firstly, I set the text box, property-->Data--> Enable = no, then the text
box becomes dim up.

Secondly, setup the comob box, name it, e.g opt
In the combo box, create an After Update event, build a macro with condition
view
assuming that your option in the combo box are "a", "b", "c", "d", "e"

Condition:[opt]="c", action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = yes
the other conditions, action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = no

Bobocat

Accessidiot said:
I have a form with multiple combo boxs, where the user selects one of five
options, for three of the options the user then needs to enter information
on
another form. It would make the second form more user friendly if only the
text boxs that were relevant were displayed and better still if they were
grouped together to make the form look tidier. Any help?
Thanks in advance.
 
This also sounds a good method I'll try this one too thanks
Ian

bobocat said:
I tried this before.
Firstly, I set the text box, property-->Data--> Enable = no, then the text
box becomes dim up.

Secondly, setup the comob box, name it, e.g opt
In the combo box, create an After Update event, build a macro with condition
view
assuming that your option in the combo box are "a", "b", "c", "d", "e"

Condition:[opt]="c", action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = yes
the other conditions, action: SetValue, Item
[Forms]![Formname]![textfieldname].[Enabled], expression = no

Bobocat

Accessidiot said:
I have a form with multiple combo boxs, where the user selects one of five
options, for three of the options the user then needs to enter information
on
another form. It would make the second form more user friendly if only the
text boxs that were relevant were displayed and better still if they were
grouped together to make the form look tidier. Any help?
Thanks in advance.
 
Back
Top