Limit the size of an Access Table

  • Thread starter Thread starter ROC
  • Start date Start date
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?
 
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
 
Back
Top