Allow only certain number of entries on continuous form...

  • Thread starter Thread starter Fletcher
  • Start date Start date
F

Fletcher

Hi, I would like to limit the number of entries that a continuous form
can enter. Is there any way to set it to, say, 6 or 8 entries before
it won't alow another?

If anyone can help me with this, it would be awesome.

Thanks in advance,
Fletcher...
 
Fletcher said:
Hi, I would like to limit the number of entries that a continuous form
can enter. Is there any way to set it to, say, 6 or 8 entries before
it won't alow another?

If anyone can help me with this, it would be awesome.

You could use code like this in the form's module:

'----- start of code -----
Public Sub LimitRecords()

Const conRecLimit = 6

With Me.RecordsetClone
If .RecordCount > 0 Then .MoveLast
Me.AllowAdditions = (.RecordCount < conRecLimit)
End With

End Sub

Private Sub Form_Current()

LimitRecords

End Sub
'----- end of code -----

If you're using the form as a subform on another form, you'll probably
also want to call the LimitRecords procedure in the main form's Current
event; e.g.,

Private Sub Form_Current()

Call Me.sfMySubform.Form.LimitRecords

End Sub
 
Back
Top