Learning by pecking away....
- Local time
- Today, 11:04
- Jun 26, 2007
Hello, I have a button to add records and I need to limit the number to 9. In my code below its bypassing the check and going to the adding of records? That's wrong with code?
Dim intMaxNumRecs As Integer intMaxNumRecs = 9 '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 cant have more than 9 SubForm Entries" End If End If End With Exit Sub Else Me.AllowAdditions = True DoCmd.GoToRecord , , acNewRec txtSequentialNumber = strNxtNum DoCmd.RunCommand acCmdSaveRecord DoCmd.GoToRecord , , acLast Me.AllowAdditions = False