I Want to Limit

K

Kevbro7189

I want to limit the number of records stored in a table. Is there a way to
do this?
 
S

Steve Schapel

Kevbro,

You can write code behind the form used to access this table. There
would be a number of options as to where to put this code. As an
example, on the Before Insert event of the form:

If DCount("*","YourTable") >= 123 Then
MsgBox "Maximum number of records exceeded.", vbExclamation
Cancel = True
End If
 
A

Arvin Meyer [MVP]

Kevbro7189 said:
I want to limit the number of records stored in a table. Is there a way to
do this?

In addition to Steve's comments, remember that you cannot allow any access
to the tables or users will be able to do almost anything they want. Make
sure your database is split:

Splitting the database:
http://www.granite.ab.ca/access/splitapp/overview.htm

and that you've secured it:

Security FAQ
http://support.microsoft.com/download/support/mslfiles/SECFAQ.EXE

Lynn Trapp's summarization:
http://www.ltcomputerdesigns.com/The10Steps.htm

KB articles:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q165009
http://download.microsoft.com/download/access97/faq1/1/win98/en-us/secfaq.exe
http://support.microsoft.com/default.aspx?kbid=325261

Joan Wild's articles:
http://www.jmwild.com/security02.htm
http://www.jmwild.com/security97.htm
http://www.jmwild.com/SecureNoLogin.htm
http://www.jmwild.com/Unsecure.htm

and/or you have locked out the user's ability to go to the database window:

http://www.mvps.org/access/general/gen0040.htm
 
T

Tom Wickerath

If you are using an Autonumber data type, set to Increment (not Randomize),
you start with an empty table, and you first compact your database, the
values should increment (1,2,3,4,5...). You can then use a validation rule,
with the appropriate validation text to limit the number of records entered.
This, of course, assumes that you hide your tables from the users. So, they
would have to go to extraordinary lengths to get around this.

You could also put a similar validation rule in the text box of a form,
where the text box is bound to your autonumber field (this text box does not
need to be visible to the user). If you create a .mde file (or .accde in
Access 2007), then this will also help to limit the number of records. I've
heard of this as a method of limiting the use of a application made available
as a demo only.


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top