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

find the correct date

Status
Not open for further replies.

saintedmunds

Technical User
Apr 7, 2006
78
GB
HI
I need a function to find the correct date to do a Dlookup.
My look up need to start on a Wednesday with the time > 8:45:00 the look up part I can do. I'm having trouble working out a way of getting the Correct Start date.

So if the date is a Monday then i need to set my lookup to the wednesday before. if the date is a Wednesday but the time is > 8:45:00 then the lookup needs to be this date not the previous Wednesday.
does this make any sense?

Cheers
 
What happens on Tuesday, Thursday and Friday?
 
How about:

[tt]sd=Now()
CTime = IIf(Weekday(sd) = 4 And Time > #8:45:00 AM#, sd, sd - 7 - Weekday(sd) + 4)[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top