Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a table that contains 3 columns:

ID            Auto increment
Username      Text
Userclass     Number

I want to give every user a userclass – this could be a number from 1 to 20, but I only want 20 users to have the same userclass.

How would I do this in Microsoft Access?

On a similar note, how would I limit the number of rows in an Access table to only 500?

share|improve this question

As far as I know there is no way to enforce these types of constraints in the table design. The builtin table storage has a very limited support of constraints, and no support for triggers. You will have to build some application logic.

share|improve this answer

The table is the data holder. There probably isn't much you can do with restricting the table. You will have far more options using VBA with the user form. Not knowing what version you have and how your form is designed, I am limited in offering advice.

VBA will allow you to use events to trigger functions which can only allow the choice from a list of what userclass iavailablele. It can also give you the ability to check the number of records in the table and stop if the maximum is reached.

If you are not familiar with VBA, there are numerous free resources available via the Internet to learn how to use it.

share|improve this answer
thank you ..i just wanted to know how this could be done and if it is possible in any way to do it directly in the table without the need to program anything ..thanks again – lebhero Feb 29 '12 at 20:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .