Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

playing around with dates 1

Status
Not open for further replies.

tziviak2

MIS
Jul 20, 2004
53
US
what I need to do is this: take a dob from a table and see according to the month which due dates I need for it.
ex the 4 months that the reports are due are nov, feb, may, and aug. now if a child's dob is in october then the first will be due on nov 1, the 2nd on feb 1st,and so on. but if a child's dob is in july then the first report will be due on aug. 1st then nov,feb,and lastly main. how would I go about it?
 
I would check out the Month and DateAdd functions in VBA, and incorporate that into a SELECT CASE statement, something like:

Dim DOB, FirstDate, SecondDate as Date

DOB = 8/26/04

Select Case month(DOB)
Case < 7
FirstDate = DateAdd("m", 1, DOB)
SecondDate = DateAdd("m", 2, DOB)
etc.....
Case 7
FirstDate = DateAdd("m", 1, DOB)
SecondDate = DateAdd("m", 4, DOB)
End Select


I didn't try this code - it most likely won't work out of the box without you fixing it, but the concept and the names of the functions would remain the same.

I am a nobody, and nobody is perfect; therefore, I am perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top