Date Validation for input box function

  • Thread starter Thread starter Surf_gecko
  • Start date Start date
S

Surf_gecko

Guest
Is there a function that can tell if a string entered using the input box function is a valid date? If not, does anyone have any code to do this?
 
Is there a way to do it without a form using the inputbox function and then testing the string received?
 
Surf_gecko,

i suspect you are looking for the IsDate() function...

____________________________________________

Dim strInput As String
Dim dtmInputDate As Date

strInput = InputBox("Enter a value")
If IsDate(strInput) = True Then
    '-- do something with date...

    '-- convert string date to vbdate...
    dtmInputDate = CDate(strInput)
Else
    '-- not a date
End If

____________________________________________

Hope that helps,

axa
 

Users who are viewing this thread

Back
Top Bottom