VB Code

T

tinab

I want to limit the # of records in a table. In the form used to
enter records into the table I put the following code on the
Form(Current):
If Me.Recordset.RecordCount >= 100 Then
MsgBox "You have reached the limit for this demo version"
Cancel = True
End If
The problem is when I try to compile the code I get an error at
Cancel=True asking for a variable.
Thank you.
 
R

Rick Brandt

tinab said:
I want to limit the # of records in a table. In the form used to
enter records into the table I put the following code on the
Form(Current):
If Me.Recordset.RecordCount >= 100 Then
MsgBox "You have reached the limit for this demo version"
Cancel = True
End If
The problem is when I try to compile the code I get an error at
Cancel=True asking for a variable.
Thank you.

The Current event doesn't have a Cancel argument. Use BeforeUpdate or
BeforeInsert.
 
Top