Limitations to data entry into a subform

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Within a subform, can data lines be limited to say 38 line
entries? At which time a warning message will appear at
the 39 line entry, "Data is limited to 38 line entries"?
 
Yes it is!

This is the way i did it in a while ago:

==================================================
Dim recClone As Recordset
Dim YourValueOfMaxNumberOfRecordsGoesHere As Integer

' Clone the set of record from form.
Set recClone = Me.RecordsetClone()


' Move to the last record in the recordset.
recClone.MoveLast


' If more then YourValueOfMaxNumberOfRecordsGoesHere records present msg and
set 'Me.AloweAdditions = False

If recClone.RecordCount > (YourValueOfMaxNumberOfRecordsGoesHere- 1)
Then
recClone.MovePrevious
MsgBox "Max " & YourValueOfMaxNumberOfRecordsGoesHere& "
Your warningsmessage", vbOKOnly + vbInformation, "Max number of records"
DoCmd.CancelEvent
Me.AllowAdditions = False
Exit Sub
Else
Me.AllowAdditions = True
End If

' Close the recordset.
recClone.Close
==========================================================

I hope this can help you out!

// Niklas
 
Back
Top