Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 19th, 2005, 02:45 PM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculating numbers of days similar to Excel

I am hung up at calculating the number of days that a process will take using the DateDiff function will only calculate the difference between two dates. However, in Excel the formula is (I+H)-G, which works fine, but to do that same or simular process in Access is causing a problem. Any suggestions would be appreciated from the Pros. Thanks...

KEL

 
Old December 20th, 2005, 08:30 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

DateDiff("d", [StartDateField], [EndDateField])

Look up DateDiff or date calculations in the Help box, too.

HTH


mmcdonal
 
Old December 23rd, 2005, 05:48 PM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi mmcdonal,
I got the DateDiff formula however the calculation they are using involves the 3 dates ex.
((I+H)-G) which is the formula used in the excel spreadsheet calculation, which is going to calculate the total number of days it took to complete the process. However in Access the DateDiff function only takes two dates in the calculation which is the DateDiff formula. I need to calculate the number of days (I+H)-G.. if it were valid it would look something like this... DateDiff("d",([Date Request]+[Date Rec'd]),[Date Rec'd in House]). Access will take the formula but the output is null.

I need a way to add the time for the first two days, then take the difference in total time.
Driving me batty with this one.. it was simple when they only had two dates...

Thanks..
KEL

Quote:
quote:Originally posted by mmcdonal
 DateDiff("d", [StartDateField], [EndDateField])

Look up DateDiff or date calculations in the Help box, too.

HTH


mmcdonal
 
Old December 27th, 2005, 08:19 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Can you explain more about the relationships between the dates?

You have a date a request is made (Date Request)
A date something was received (Date Rec'd)
And another date something was received somewhere else (Date Rec'd in House)

What are their relationships? What date are you subtracting that last field from?

BTW, this is not a good naming convention since there are spaces, and the first single word is a reserved name, and there is a "'" in the field name.




mmcdonal
 
Old December 27th, 2005, 04:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Your DateDiff would not be this

DateDiff("d",([Date Request]+[Date Rec'd]),[Date Rec'd in House])

but it would be this, a combo of DateDiff AND DateAdd:

=DateAdd("d", DateDiff("d",[Date Request],[Date Rec'd]), [Date Rec'd in House])

The embedded DateDiff function would return the number of days between date request and date received and then add that integer via the DateAdd function to the date received in-house to give you a final date.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old December 30th, 2005, 05:47 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to anukagni Send a message via Yahoo to anukagni
Default

Hie Greg,

  Whould u able to sent me an Exmpl for the above said.,
    I am fumbling Here...

P.A.P.Raguv,
Executive Manager ,Planning Warehouse Logistics ,

P.Anukprasanna,
Integrety Logistics Executive,
 
Old January 3rd, 2006, 12:32 PM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi! Hope all had a good holiday! Now back to the grinding stone. To attempt at explaining what I have are three Dates, (Date something was Requested, Date Something was sent for approval, and the Date something was originally rec'd.) As I stated the Excel formula is: (Date_Sent + Emerg_Date_Requested)- Date_Rec'd. The formula is suppose to track the total time the process takes and give the number of days it took total. So in all the Last field should be subtracted from the total time of Sent+Requested which should give the number of days for a process.

Now I thought of another way to do it after analyzing the information more and thats probably putting into a procedure using If, Then, Else.
Ex.: If [Emerg_Date_Requested]= "", then [Date_Sent]-[Date_Rec'd], Else [Emerg_date]-[Date_Rec'd].

I appreciate all and any help you might offer.

Quote:
quote:Originally posted by mmcdonal
 Can you explain more about the relationships between the dates?

You have a date a request is made (Date Request)
A date something was received (Date Rec'd)
And another date something was received somewhere else (Date Rec'd in House)

What are their relationships? What date are you subtracting that last field from?

BTW, this is not a good naming convention since there are spaces, and the first single word is a reserved name, and there is a "'" in the field name.




mmcdonal
 
Old January 3rd, 2006, 02:43 PM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm just curious, that Excel formula gives you the number of days the process took? It would seem to me that based on the three numbers all being dates, that adding two and subtracting one that are all more or less equal.. would result in just getting a date somewhat close to the others. Perhaps I'm just confused since the variable names do not seem to equate to the definitions given, and that the sent/rec'd parties are not clearly ID'd.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Similar Delete Cascade prasanna.nadgir C# 6 August 28th, 2007 04:12 AM
Similar book for JBoss? prateep BOOK: Professional Apache Tomcat 0 November 24th, 2005 07:24 AM
Similar to the PROPER function in EXCEL mcinar HTML Code Clinic 7 March 29th, 2005 12:34 PM
Here is some similar problem amit_bhatia Beginning PHP 1 December 7th, 2004 11:30 AM
Calculating number of days between multiple dates Vann Access 4 December 3rd, 2004 08:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.