View Full Version : Access 2000 - Restrict User to key in certain fields


sallypeh
09-26-2005, 10:01 PM
Hi, I would like to know how to do the following scenario in Access 2000.

Imagine I have a table, which has two fields X and Y.
User can only enter either field X or Y, but not both.
How to check the above case while user is real-time keying in the fields of the table?

Thanks, Sally

The_Doc_Man
09-26-2005, 10:34 PM
user is real-time keying in the fields of the table?

NEVER EVER DO THIS if you are worried about security. If you have a bunch of thumb-fingered idiots keying into your tables, folks who fail to follow the rules of data entry, DON'T TRUST THEM INSIDE YOUR TABLES.

Always build a form and hide the table. Then put some smarts in the form. You cannot put code behind a table or query but you CAN put various kinds of smarts behind a form.

Build a query for your table. Build a form for the query. Make the table read-only for the average user. Mark the query as owned by you (or Admin or someone with write privs to the table). Now change the form to use the query using ByOwner. Enforce your "X or Y but not both" in the form.

sallypeh
09-26-2005, 10:39 PM
Is there any way to do in Access? My users are keying in
directly into the database for now.
Thanks, Sally