Cool...thanks :cool: :D :) :p ;)
Printable View
Cool...thanks :cool: :D :) :p ;)
This will validate a date . . .
VB Code:
If lMonth < 1 Or lMonth > 12 Then 'Out of month range fRet = False Else If lDay < 1 Or lDay > DaysInMonth(lMonth, lYear) Then 'Out of day range fRet = False End If End If Public Function DaysInMonth(lMonth As Long, lYear As Long) As Long 'Proposition Place holders . . . Dim a As Boolean, b As Boolean, c As Boolean 'Proposition assignments . . . a = lMonth >= 8 b = lMonth Mod 2 = 0 c = lMonth = 2 'Logic Resolution (see notes above) . . . DaysInMonth = 31 + ((a And Not (b)) Or (Not (a) And b And Not (c))) + _ (3 * c) - (c And IsLeapYear(lYear)) End Function Public Function IsLeapYear(lYear As Long) As Boolean Dim a As Boolean a = lYear Mod 4 = 0 IsLeapYear = (a And lYear Mod 400 = 0) Or (a And lYear Mod 100 <> 0) End Function
Just for a bit of fun . . ..
:D