A
alex
On Exit Event
Hello,
I have a form that opens to a new record. I set the focus to a
control that I want the user to populate without going any further.
This code below will not work, however, because the record has yet to
be created:
Private Sub comSubject_BeforeUpdate(Cancel As Integer)
If IsNull(Me.comSubject) Then
MsgBox "You cannot leave the [Subject] field empty!"
Cancel = True
Me.Undo
End If
I suppose I could add a default value or make the record dirty, but
that seems unnecessary.
This code works too well; I can’t move anywhere until I populate the
control:
Private Sub comSubject_Exit(Cancel As Integer)
'If IsNull(Me.comSubject) Then
' MsgBox "You cannot leave the [Subject] field empty!"
' Cancel = True
' Me.Undo
'End If
What I would like to do is not allow the user to continue (like the
exit code example) except if he/she wants to go to another record
(using the navigation buttons at the bottom of the form), essentially
canceling the creation of a new record.
Can I do that?
alex
Hello,
I have a form that opens to a new record. I set the focus to a
control that I want the user to populate without going any further.
This code below will not work, however, because the record has yet to
be created:
Private Sub comSubject_BeforeUpdate(Cancel As Integer)
If IsNull(Me.comSubject) Then
MsgBox "You cannot leave the [Subject] field empty!"
Cancel = True
Me.Undo
End If
I suppose I could add a default value or make the record dirty, but
that seems unnecessary.
This code works too well; I can’t move anywhere until I populate the
control:
Private Sub comSubject_Exit(Cancel As Integer)
'If IsNull(Me.comSubject) Then
' MsgBox "You cannot leave the [Subject] field empty!"
' Cancel = True
' Me.Undo
'End If
What I would like to do is not allow the user to continue (like the
exit code example) except if he/she wants to go to another record
(using the navigation buttons at the bottom of the form), essentially
canceling the creation of a new record.
Can I do that?
alex