Open and close field based on input of another field

Certified

Board Regular
Joined
Jan 24, 2012
Messages
189
Hello,

I have a Table with 11 fields.

The first field is a drop-down field with two options. Lets call them option A and option B.

The remaining 10 fields relates to either option A or option B, but not both.

For example, if option A is selected, then fields 2, 4, 8, and 10 would apply.

Is there a way I can deny the user to the other fields (3,5,7 and 9), when option A is selected?
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Yes, use a form.
Users should not have tables/queries exposed to them directly.
They should access the data through forms.
 
Upvote 0
Sorry, I was not clear.

Yes, this would be a form, but how would I code the fields. I am new to Access.
 
Upvote 0
I would probably have the form with only the dropdown visible, then when changed as Joe4 has advised, you make the relevant controls visible.
You probably have not thought of this yet, but what happens when you move through existing records.?
You would need code in the Current event as well, so might be better to make a private sub in the form that does all this and then call it from AfterUpdate and Current events of the form.?

HTH
 
Upvote 0
Or you could use Conditional formatting, there is an option to enable/disable the control. This doesn't require any coding and works for new or existing records.

One caveat for both options is if your control is enabled, data is added and then the control is disabled you could have records that don't meet your business rule but have been allowed to enter data.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,172
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top