PC Review


Reply
Thread Tools Rate Thread

Adding up days from Date/Time entered

 
 
Jeffrey Wilson
Guest
Posts: n/a
 
      3rd Mar 2010
I'm new to Access and have a Table where I'd like to put in a Beginning date
that an item was sent out on rent, and then put a date where it was returned
from being on rent. I'd like to set up a record that sums the number of days
that item was out, based on the previous two records.

I'm looking for this to be shown in the Form view, as a user is putting in
the dates.

Thank you
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      3rd Mar 2010
Jeffrey,

Look at the DateDiff function in the Help file.

Steve
(E-Mail Removed)


"Jeffrey Wilson" <Jeffrey (E-Mail Removed)> wrote in message
news:1899A597-DCFD-4F4E-A999-(E-Mail Removed)...
> I'm new to Access and have a Table where I'd like to put in a Beginning
> date
> that an item was sent out on rent, and then put a date where it was
> returned
> from being on rent. I'd like to set up a record that sums the number of
> days
> that item was out, based on the previous two records.
>
> I'm looking for this to be shown in the Form view, as a user is putting in
> the dates.
>
> Thank you



 
Reply With Quote
 
John W. Vinson
Guest
Posts: n/a
 
      3rd Mar 2010
On Tue, 2 Mar 2010 16:22:14 -0800, Jeffrey Wilson <Jeffrey
(E-Mail Removed)> wrote:

>I'm new to Access and have a Table where I'd like to put in a Beginning date
>that an item was sent out on rent, and then put a date where it was returned
>from being on rent. I'd like to set up a record that sums the number of days
>that item was out, based on the previous two records.
>
>I'm looking for this to be shown in the Form view, as a user is putting in
>the dates.
>
>Thank you


The time duration should be calculated on the fly, NOT stored in any table: if
you store both dates and the duration then any of the fields could be edited,
giving anomalies such as a DateOut of #2/1/2010#, DateReturned of #3/2/2010#,
and a duration of 3 days!

Instead, just store the dateOut and DateReturned, and set the Control Source
of a textbox on the form to

=DateDiff("d", [DateOut], [DateReturned])

If you want to see the days out up to today's date if the item has not yet
been returned, i.e. DateReturned is NULL, use

=DateDiff("d", [DateOut], NZ([DateReturned], Date()))
--

John W. Vinson [MVP]
 
Reply With Quote
 
Jeffrey Wilson
Guest
Posts: n/a
 
      4th Mar 2010
John,

Thank you for the expression! I had been reading the help files on the
DateDiff and just wasn't piecing it together. That helped me understand it
better and seems to work great!

Many Thanks
Jeffrey Wilson

"John W. Vinson" wrote:

> On Tue, 2 Mar 2010 16:22:14 -0800, Jeffrey Wilson <Jeffrey
> (E-Mail Removed)> wrote:
>
> >I'm new to Access and have a Table where I'd like to put in a Beginning date
> >that an item was sent out on rent, and then put a date where it was returned
> >from being on rent. I'd like to set up a record that sums the number of days
> >that item was out, based on the previous two records.
> >
> >I'm looking for this to be shown in the Form view, as a user is putting in
> >the dates.
> >
> >Thank you

>
> The time duration should be calculated on the fly, NOT stored in any table: if
> you store both dates and the duration then any of the fields could be edited,
> giving anomalies such as a DateOut of #2/1/2010#, DateReturned of #3/2/2010#,
> and a duration of 3 days!
>
> Instead, just store the dateOut and DateReturned, and set the Control Source
> of a textbox on the form to
>
> =DateDiff("d", [DateOut], [DateReturned])
>
> If you want to see the days out up to today's date if the item has not yet
> been returned, i.e. DateReturned is NULL, use
>
> =DateDiff("d", [DateOut], NZ([DateReturned], Date()))
> --
>
> John W. Vinson [MVP]
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show all records *days after date entered in date field =?Utf-8?B?UkRSZXNlYXJjaA==?= Microsoft Access Queries 1 28th Oct 2006 04:06 AM
Need date to appear 90 days later than initial date entered =?Utf-8?B?QmVja3k=?= Microsoft Excel Worksheet Functions 6 16th Sep 2005 02:48 PM
Adding Days to an entered date =?Utf-8?B?Q2Fyb2w=?= Microsoft Access 6 1st Jun 2005 12:07 AM
Calculate 90 calendar days from date entered =?Utf-8?B?Q2R1bm5iZ28=?= Microsoft Access 1 23rd Nov 2004 04:30 PM
Return Days since Date Entered in Column. Mcasteel Microsoft Excel Programming 3 18th Nov 2004 04:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:58 AM.