I would like to know if there is a way to limit a table to contain, for example maximum 5 records. Pls help !! I hope that tomorow I'll still be alive and kicking.
I don't think there's an intrinsic restriction in a table for this kind of thing, but you can do it with code. I'll give an example, and you can modify this to fit your situation (This code would be on a form bound to your table.):
Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
If Me.RecordsetClone.RecordCount = 5 Then
MsgBox "Nope!"
Cancel = True
End If
End Sub
Basically, before a new record is inserted, you check to see if your table already has 5 records. If so, then cancel the insert and alert the user. Piece of cake, right?
Piece of cake? Not for me.I'm new to this and I cannot understand how to do it. I should better explain my problem. I have a web interface in wich I give to other users acces to an Access table.It creates an Access table for each user and I cannot change the interface to limitate the number of records in each table. This property must be set in db.I do not know how. Pls help! I hope that tomorow I'll still be alive and kicking.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.