VB Code

  • Thread starter Thread starter tinab
  • Start date Start date
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top