D
DCPan
Hi all,
I set a condition on a textbox so that on "when exit", it will see if
another textbox value is zero, and if the value is not zero, see if the
textbox is null, otherwise, set the cursor back to the textbox.
The if then statements do work as the msgbox is triggered to notify the user
that comments need to be entered when the value isn't zero.
But the setfocus isn't working and it isn't a typo...what's up?
Private Sub DailyComments_Exit(Cancel As Integer)
'Set up Error Handling Tracer
strModule = "Form_frm_DailyVariance"
strProcedure = "DailyComments_Exit"
'Error Handling
On Error GoTo ErrorFlow
'Check to see if a comment is needed
If Me.DailyVariance <> 0 Then
'Check to see if there are any comments
If IsNull(Me.DailyComments) Then
MsgBox "You must explain why the daily variance is not zero in
the
comment section!", _
vbInformation, "Clarification needed!"
'Set focus on the comment box
Me.DailyComments.SetFocus
End If
End If
Exit_Code:
Exit Sub
ErrorFlow:
'Use Global_Error_Handler
HandleError Err.Number, Err.Description, strModule, strProcedure, True
'Exit Error Handler
Resume Exit_Code
End Sub
I set a condition on a textbox so that on "when exit", it will see if
another textbox value is zero, and if the value is not zero, see if the
textbox is null, otherwise, set the cursor back to the textbox.
The if then statements do work as the msgbox is triggered to notify the user
that comments need to be entered when the value isn't zero.
But the setfocus isn't working and it isn't a typo...what's up?
Private Sub DailyComments_Exit(Cancel As Integer)
'Set up Error Handling Tracer
strModule = "Form_frm_DailyVariance"
strProcedure = "DailyComments_Exit"
'Error Handling
On Error GoTo ErrorFlow
'Check to see if a comment is needed
If Me.DailyVariance <> 0 Then
'Check to see if there are any comments
If IsNull(Me.DailyComments) Then
MsgBox "You must explain why the daily variance is not zero in
the
comment section!", _
vbInformation, "Clarification needed!"
'Set focus on the comment box
Me.DailyComments.SetFocus
End If
End If
Exit_Code:
Exit Sub
ErrorFlow:
'Use Global_Error_Handler
HandleError Err.Number, Err.Description, strModule, strProcedure, True
'Exit Error Handler
Resume Exit_Code
End Sub