A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Limit the size of an Access Table



 
 
Thread Tools Display Modes
  #1  
Old November 24th, 2008, 03:49 AM posted to microsoft.public.access.tablesdbdesign
ROC
external usenet poster
 
Posts: 11
Default Limit the size of an Access Table

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?
  #2  
Old November 24th, 2008, 06:00 AM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Limit the size of an Access Table

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ROC" wrote in message
news
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?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.