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

Add weekdays only 1

Status
Not open for further replies.

primagic

IS-IT--Management
Joined
Jul 24, 2008
Messages
476
Location
GB
HI

I have a query which has a DateField with a number of days field

So DateAdded = 01/01/2009, Service Level days = 7. So I want to add only 7 weekdays to that DateAdded. To get 12/01/2009

At the moment I only can add 7 days in total. Which gives me 08/01/2009.

My code is:
Code:
InitialChaseDate: [ServiceLevel]+[DateAdded]

Help please
 
Thanks for your help

But these functions calculate between two dates. My Service Level field is not a date but a number i.e 1 = 1 day, 7 = days, 56 = 56 days

So when I use the functions doesn't give out a correct date
 
I think you will find that the function I posted by MichaelRed has two parameters:

[tt]Public Function basMtgDate(Optional NumDays As Integer = 1, Optional startdate As Variant) As Date[/tt]

So it should be possible to use ServiceLevel for NumDays and DateAdded for startdate, yesno?

 
Hi Remou

That function you posted requires me to create a holidays table which I would always need to keep updated. I don't need to worry about holidays, just want to exclude weekends
 
It should be simple enough to modify the function to stop it needing the holidays table, for example, just remove the whole of Case Else.

 
Ok I have modified the code, could you tell me please how would I implement that into a query or form. I dont understand the usage part of the code supplied

Thanks
 
I mislead you a little, case else should read:

Code:
Case Else
     MyDays = MyDays + 1

One way to use it in a form, would be to set the control source to:

=BasMtgDate([ServiceLevel], [DateAdded])

You could do something similar with a query.


 
Thank you Remou

It works perfectly now. Much appreciated
 
No problem, but how do you add a star?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top