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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Calculations?

Status
Not open for further replies.

jgoodman00

Programmer
Joined
Jan 23, 2001
Messages
1,510
I have a date field, which I plan on coloring according to its relationship with the current date.

If the current date is within 3 months of the specified date it is assigned an orange color.

If the current date is within 1 month of the specified date it is assigned a red color.

How do you test to see whether or not the current date falls within these boundaries?

I am sure it could be done by extracting each part of the date & then testing them individually, but this seems a little long winded when I would have thought this should be quite simple to accomplish in one step.......

James Goodman
j.goodman00@btinternet.com
 
How about:

select case DatePart("m", Date) - DatePart("m", txtdate)

case 2
do something

case 3

do something

end select

Nick
 
You could place this code on the On_Current event of the form

Nick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top