| This will convert a date to the last day of the month in Visual
Basic Sub Command1_Click()
'No need to Dim values, but you can if you want to
ToDate = Format("2/15/2000") ' get from a variable or from data base
TempDate = DateValue(Format(ToDate, "mmm") + "/01/" + Format(ToDate,
"yyyy"))
TempDate = DateValue(TempDate) + 32
TempDate = DateValue(Format(TempDate, "mmm") + "/01/" +
Format(TempDate, "yyyy")) - 1
ToDate = Format(TempDate, "mm/dd/yyyy")
Debug.Print ToDate 'results = "2/29/2000"
End Sub
Return to Mini Solve products and more Tips
|