why doesn't this work?

Anne
04-17-2004, 04:48 AM
Do
FirstDate = InputBox("Enter the first date", "First Date", "05/04/2000")

LastDate = InputBox("Enter the last date", "Last Date", "04/04/2000")

Loop Until IsDate(FirstDate) = True And IsDate(LastDate) = True

When I enter an invalid date in the first box it goes crazy. How can I get it not to freeze when something invalid is entered.
FirstDate and LastDate are dim as date. Please help asap :(

Shurik12
04-17-2004, 05:47 AM
Hi,

This part doesn't make much sense in my view:

Loop Until IsDate(FirstDate) = True And IsDate(LastDate) = True

If you need to check the InputBox's values:

If IsDate(FirstDate) And IsDate(LastDate) Then
'do something here
End If


On the other hand you could overweigh using DataPicker control instead.


Shurik.

Anne
04-17-2004, 06:30 AM
I've solved it now :P

Do
InputFirstDate = InputBox("Enter The First Date.", "First Date", "05/04/2000")
Loop Until IsDate(InputFirstDate) = True

If IsDate(FirstDate) = True Then
Do
InputLastDate = InputBox("Enter the last date", "Last Date", "04/04/2000")
Loop Until IsDate(InputLastDate) = True
End If

Thanks anyway :P

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum