C
cesw
Hi - we are using Excel 2000 VBA
When an error occurs, I want to put up a message box and then put th
cursor in the incorrect textbox on my form.
Here is the code - comments to the left indicate what happened when
stepped through the code with the debugger:
Private Sub tbEnd_AfterUpdate()
If tbEnd <> "" Then
If Not isValidDate(tbEnd) Then
MsgBox ("End Date Invalid") ' displays fine, use
clicks ok
ckbTTM.SetFocus ' pgm continues, an
focus is set here
ckbCustID.SetFocus ' pgm cont, and focu
is set here
tbEnd.SetFocus ' pgm cont, focu
stays ckbCustID
End If
End If
End Sub ' return t
form and focus is on OK button
Private Sub tbStart_AfterUpdate()
If tbStart = "" Then ' user enter
incorrect date and tabs
MsgBox ("Start Date Required") ' msgbox works fine
Me.tbStart.SetFocus ' focus is on next Ta
stop
Exit Sub
End If
If Not isValidDate(tbStart) Then
MsgBox ("Start Date Invalid")
tbStart.SetFocus ' same thing
End If
End Sub
Any thoughts?
Th
When an error occurs, I want to put up a message box and then put th
cursor in the incorrect textbox on my form.
Here is the code - comments to the left indicate what happened when
stepped through the code with the debugger:
Private Sub tbEnd_AfterUpdate()
If tbEnd <> "" Then
If Not isValidDate(tbEnd) Then
MsgBox ("End Date Invalid") ' displays fine, use
clicks ok
ckbTTM.SetFocus ' pgm continues, an
focus is set here
ckbCustID.SetFocus ' pgm cont, and focu
is set here
tbEnd.SetFocus ' pgm cont, focu
stays ckbCustID
End If
End If
End Sub ' return t
form and focus is on OK button
Private Sub tbStart_AfterUpdate()
If tbStart = "" Then ' user enter
incorrect date and tabs
MsgBox ("Start Date Required") ' msgbox works fine
Me.tbStart.SetFocus ' focus is on next Ta
stop
Exit Sub
End If
If Not isValidDate(tbStart) Then
MsgBox ("Start Date Invalid")
tbStart.SetFocus ' same thing
End If
End Sub
Any thoughts?
Th