Private sub Form_BeforeInsert(Cancel as Integer)
If Me.txtCount > 5 Then
Cancel = True
Me.Undo
Msgbox "Please return a book before checking out a new one", vbOKOnly
End If
End Sub
Ideally, you'd want to warn them that they can't fill it out again BEFORE they do so rather than undoing it after they've filled it in.The BeforeInsert event runs after the FIRST character is typed into a new record so the user hasn't expended any energy at this point. This is the correct event to use.
ASKER
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY
Ideally, you'd want to warn them that they can't fill it out again BEFORE they do so rather than undoing it after they've filled it in.