Ben_Entrew
Registered User.
- Local time
- Today, 14:00
- Joined
- Dec 3, 2013
- Messages
- 177
Dear all,
I would like to select a case depending on the output of a function.
This function tests the syntax of the reporting month.
If the syntax is fine nothing should be done further in the main sub else it should return to the Input window for the reporting month.
Somehow it doesn't work out.
Maybe someone out there has a clue?
Thanks in advance.
Regards,
Ben
I would like to select a case depending on the output of a function.
This function tests the syntax of the reporting month.
If the syntax is fine nothing should be done further in the main sub else it should return to the Input window for the reporting month.
Somehow it doesn't work out.
Maybe someone out there has a clue?
Thanks in advance.
Regards,
Ben
Code:
Public Function RepMonthCheck(rep_date As String) as Boolean
If Len(rep_date) <> 6 Or Left(rep_date, 2) > 12 Or Left(rep_date, 2) < 1 Then
MsgBox ("Reporting rep_date is not in the correct format = mmyyyy")
Return False
ElseIf Right(rep_date, 4) > 9998 Then
MsgBox ("No forecast available for year 9998")
Return False
Else
Return True
End If
End Function
Sub IMPORT
Dim repmonth As String
Dim Test2 As Boolean
NewEntry
repmonth = InputBox("Please type in the reporting month", "Reporting_Month"e, "", 5000, 5000)
RepMonthCheck (repmonth,Test2)
If Test2 = False Then
GoTo NewEntry
Else
End If
End Sub