No New Records

S

sturner333

I have a form that is populated witha query. I would like to not allow the
form to keep forwarding to new blank records. For example there are 12
records, when you use the record controls and get to record 12, you are not
allowed to go to 13, or at least not 14.
Thanks for the help.
 
S

sturner333

Also, the Allow No New Record property doesn't help me. I would like to allow
a new record under certain conditions. I could do it in VBA if there is a
way. Thanks
 
J

John W. Vinson

Also, the Allow No New Record property doesn't help me. I would like to allow
a new record under certain conditions. I could do it in VBA if there is a
way. Thanks

You'll need to put code in the Form's BeforeInsert event:

Private Sub Form_BeforeInsert(Cancel as Integer)
If <conditions> Then
MsgBox "Only 12 records please!", vbOKOnly
Cancel = True
End If
End Sub

where <conditions> is an expression that is true if the user has hit the limit
of allowed records.

John W. Vinson [MVP]
 
Top