T
Tony Williams
I have a form that I want to ensure that the user completes their name in one
of the controls before the record is saved. I have a message created in the
Before Update of the form but although the message appears I can't get back
into the control to enter the name. I have that control locked and think I
may have the code in the incorrect event. here is my forms VBA code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.txtenteredby) Then
MsgBox "Please enter your name in the Entered By box before saving this
record", vbOKOnly
End If
End Sub
Private Sub Form_Current()
If Me.NewRecord Then
Me.txtActionLog.Locked = False
Me.txtenteredby.Locked = False
Else
Me.txtActionLog.Locked = True
Me.txtenteredby.Locked = True
End If
End Sub
Private Sub txtActionLog_AfterUpdate()
If Me.NewRecord Then
Me.txtTimeDate = Now
End If
End Sub
Could someone point me to where I'm going wrong?
Thanks
Tony
of the controls before the record is saved. I have a message created in the
Before Update of the form but although the message appears I can't get back
into the control to enter the name. I have that control locked and think I
may have the code in the incorrect event. here is my forms VBA code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.txtenteredby) Then
MsgBox "Please enter your name in the Entered By box before saving this
record", vbOKOnly
End If
End Sub
Private Sub Form_Current()
If Me.NewRecord Then
Me.txtActionLog.Locked = False
Me.txtenteredby.Locked = False
Else
Me.txtActionLog.Locked = True
Me.txtenteredby.Locked = True
End If
End Sub
Private Sub txtActionLog_AfterUpdate()
If Me.NewRecord Then
Me.txtTimeDate = Now
End If
End Sub
Could someone point me to where I'm going wrong?
Thanks
Tony