Private Sub Form_Current() Dim intMaxNumRecs As Integer intMaxNumRecs = 1 'Max Number of Records to Allow If Me.NewRecord Then With Me.RecordsetClone If .RecordCount > 0 Then .MoveLast: .MoveFirst If .RecordCount >= intMaxNumRecs Then MsgBox "You can't add more than " & intMaxNumRecs & " record of Quantity for each product condition!", vbInformation, "Warning" .MoveLast Me.Bookmark = .Bookmark End If End If End With End If End Sub
Private Sub Form_Current() If Me.RecordsetClone.RecordCount >= 1 Then Me.AllowAdditions = False Else Me.AllowAdditions = True End If End Sub
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.