Hey all,
I am having my error handler work only sometimes and I can't figure out why. What is causing the inconsistency?
Dim DataMonth
Dim DataMonthFormatted
Dim ETCMonth
DataMonth = InputBox("Please enter a data month. (Mm/01/Yyyy)")
'Processes date information again if it is entered incorrectly
Static ErrCount As Integer
On Error GoTo ErrHandler
...more code...
Exit Sub
ErrHandler:
ErrCount = ErrCount + 1
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
If ErrCount = 4 Then
MsgBox ("I've just picked up a fault in the AE35 unit. It's going to go 100% failure in 72 hours Dave. ")
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
ElseIf ErrCount = 9 Then
MsgBox ("Just what do you think you're doing, Dave? ")
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
Else
Resume
End If
Resume
End Sub
I am having my error handler work only sometimes and I can't figure out why. What is causing the inconsistency?
Dim DataMonth
Dim DataMonthFormatted
Dim ETCMonth
DataMonth = InputBox("Please enter a data month. (Mm/01/Yyyy)")
'Processes date information again if it is entered incorrectly
Static ErrCount As Integer
On Error GoTo ErrHandler
...more code...
Exit Sub
ErrHandler:
ErrCount = ErrCount + 1
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
If ErrCount = 4 Then
MsgBox ("I've just picked up a fault in the AE35 unit. It's going to go 100% failure in 72 hours Dave. ")
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
ElseIf ErrCount = 9 Then
MsgBox ("Just what do you think you're doing, Dave? ")
DataMonth = Application.InputBox _
("Please enter the closest date that resembles " & _
DataMonth & _
", in format (Mm/01/Yyyy)", "Invalid Date Format!")
Else
Resume
End If
Resume
End Sub