Full Version: Using a radio button to show/hide form fields
UtterAccess Forums > Microsoft® Access > Access Forms
ChrisF79
Greetings,
I have a form where I would like the user to be forced to select if a payment is for one of our employees or someone outside of the company. Based on their selection from the radio button, different fields of the form would be shown below. For example, if they select the radio button for our employee, a combobox with our employee names would be shown. However, if they select the radio button for an outside agent, it would show a textbox where they could type in the person's name.
Can this be done?
Thanks in advance for any help!
freakazeud
Hi,
Sure can!
On the on click event of your button just put code like this:

Me.YourField.Visible = True

Yourfield can be a textbox or a combobox or whatever you want it to be.
Make sure that on the form on open event you hide all the fields
(Me.YourField.Visible = False) so they have to make the button selection to unhide them.
If you don't want to hide them you can lock them or enable/disable them.
Me.YourField.Enabled = True
Me.YourField.Locked = True

HTH
Good luck
ChrisF79
Thank you so much for the fast reply. That works amazingly well! I decided against the radio buttons and went with the normal command buttons but it does exactly what I need. Thanks again!
freakazeud
You're welcome.
Glad I could assist.
Good luck on future projects.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.