Dates in Access

G

Guest

I need a date field in access to automatically default to 30 days plus over
another date field? Is there a way to do this but also allow it to be
overwritten manually in a form?

Also, is there a way to calculate number of business days between dates in
Access? I have many reports which involve subtracting one date from another
to determine if the project was done on time (but I don't know how to exclude
weekends)

Thank you,
KBV
 
G

Guest

Hi,
as a general rule you do not want to store calculated values in tables. They
can be calculated at runtime as needed on forms/reports or in queries. Then
you can use the DateAdd() function in the following manner:

=DateAdd("d",+30,[OtherDateField])

For the workdays problem...Access has not build in NetWorkDays function like
Excel does...so you need to implement a custom solution to this problem.
There are many samples you can adapt though e.g.:
http://www.mvps.org/access/datetime/date0012.ht
http://www.utteraccess.com/forums/s...u=87483&Zd=l&Zn=&Zt=5&Zs=b&Zy=#Post1180429&Zp
http://www.utteraccess.com/forums/s...pe=m&olderval=&oldertype=#Post368429&bodyprev
http://www.utteraccess.com/forums/s...pe=m&olderval=&oldertype=#Post509971&bodyprev
http://www.utteraccess.com/forums/s...pe=m&olderval=&oldertype=#Post323579&bodyprev
http://www.utteraccess.com/forums/s...pe=m&olderval=&oldertype=#Post95181&bodyprev=
....
HTH
Good luck
 
A

Al Camp

KBV,
Re Dates:
Given Date1, Date2 should always start out by being 30 days greater?
Use the AfterUpdate event of Date1 to "initially set" Date2...
Date2 = Date1 + 30 ' (for 30 days)
or
Date2 = DateAdd("m", +1, Date1) ' (for 1 month exactly)
Date2 can still be overridden manually

Re WorkDays:
Try the Google Access Groups for "public.access" "calculate" "workdays".
There are many solutions listed there...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top