>Is there another/better way to set a limit on number of
>records . . . possibly one that gives an error message
>when they have exceeded the limit?
One sneaky way is to use an Integer field as a Primary Key; set that
field's Validation Rule to
> 0 AND <= 100
to limit the table to 100 records. The Primary Key constraint won't
let you add duplicates, and the validation rule won't let you add
values outside the range 1 to 100.
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
Vernon - 02 Aug 2004 14:41 GMT
John,
Thanks for your response. I have assigned the primary
key to an ID field with the type set to AUTONUMBER . . .
the Validation Rule is not available for autonumber for
some reason. I want this value assigned
automatically . . . is there a way to make an "Integer
field" behave like an autonumber (increment)?
Thanks again. DV
>-----Original Message-----
>
[quoted text clipped - 15 lines]
>http://go.compuserve.com/msdevapps?loc=us&access=public
>.
John Vinson - 02 Aug 2004 21:04 GMT
>John,
>
[quoted text clipped - 4 lines]
>automatically . . . is there a way to make an "Integer
>field" behave like an autonumber (increment)?
You can, by using a Form to do your data entry. In the Form's
BeforeInsert event put code like
Private Sub Form_BeforeInsert(Cancel as Integer)
Dim iNext As Integer
iNext = NZ(DMax("[ID]", "[yourtable]")) + 1
If iNext > 100 Then
MsgBox "The table is full. Go away.", vbOKOnly
Cancel = True
Else
Me.txtID = iNext
End If
End Sub
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public