Limit the size of an Access Table

R

ROC

I want to create a table that will accept only a limited number of records -
say 10 records. I want the user to be able delete or add records but I don't
want the total number of records to exceed 10. How do I do this?
 
A

Allen Browne

Assuming that your interface means users can only add new records via a
form, use the BeforeInsert event procedure to test if there are already 10
in the table.

This kind of thing:

Private Sub Form_BeforeUpdate(Cancel As Integer)
If DCount("*", "Table1") >= 10 Then
Cancel = true
MsgBox "no more!"
End If
End Sub
 

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