Disabling Certain Fields on a Data Entry Form

Fritz24

Board Regular
Joined
Sep 8, 2004
Messages
102
I have a data entry form in a database and I'd like to make certain fields in the form unavailable depending on the criteria in one of the fields.

Example: In my company we have different systems used in different offices. My database stores employee details for people in all offices. Some of the details won't be relevant to certain people, but the data entry form shows all fields, relevant or not. I'd like to disable the irrelevant fields.

Something like: If [Location] = Nottingham Then (code to disable the irrelevant field would go here)

Hope that makes sense.
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Joined
Mar 23, 2004
Messages
241
I've had to do something similar, and the best way I've found is to simply make the no-longer-required fields vanish.

So, something like (using your example and Systemname as one of the fields you want to hide):
Code:
If Location = Nottingham Then
Me.Systemname.Visible = False
This means that they won't even try to enter data in. You could also use (and I think this is right)
Code:
Me.Systemname.Locked = True
But if you use the second method and your staff are anything like ours, you'll get people asking you all the time why they can't enter data in those fields!! :rolleyes:

HTH...
 

Fritz24

Board Regular
Joined
Sep 8, 2004
Messages
102
Lordy that's hideously simple but does the job spot on.

Many thanks for your help! :LOL:
 
Joined
Mar 23, 2004
Messages
241
Glad to have been of assistance. I think it's the first time I've actually managed to help someone properly!!

I'm a real access newbie, so I feel a little less guilty about taking so much help while giving so little back now...! :biggrin:
 

Watch MrExcel Video

Forum statistics

Threads
1,127,605
Messages
5,625,759
Members
416,135
Latest member
abtabt

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
Top