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

Calculating date based on user-inputted date

Status
Not open for further replies.

mbaddar

Programmer
May 10, 2001
120
US
Hi,

Can anyone point me in the right direction here? I have a date field in my table that I'm looking at. I want to take this date and find the first Friday following this date (I need to calculate this date for a report).

Any ideas on what would be an easy way to calculate this "first Friday" date? I checked out the vb date functions. I didn't see anything that seemed very helpful.

Thanks,
MBaddar
 
Hi there
The VB WEEKDAY function gives you the day of the week for any date e.g. WeekDay(YOURDATE) - range is 1 to 7 and check your local settings.

DateAdd allows you to calculate one date from another by adding on a number of days, months or years.

Combine the two and you should get what you need.
Cheers
Tom
 
Hi Tom,

Thanks for the answer. I accidentally posted this question twice and I got a similiar response from another tipster in that thread. You were both correct. I didn't know VB had a weekday function. That's good to know.

Thanks much,
MBaddar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top