PC Review


Reply
Thread Tools Rate Thread

Calculate date difference between fixed date and current date

 
 
Dave Elliott
Guest
Posts: n/a
 
      23rd May 2005
i need to calculate the number of days between my control (StartDte) and the
current date
StartDte is in this format m/d/yy with ainput mask of
99/99/00;0;_

the other unbound calculated field needs to show the number of days between
the 2 values.
other field is named (unbound) late



 
Reply With Quote
 
 
 
 
G. Vaught
Guest
Posts: n/a
 
      23rd May 2005
Use the function DateDiff.
Code versionDim TheDate As Date ' Declare variables.
Dim Msg
TheDate = InputBox("Enter a date")
Msg = "Days from today: " & DateDiff("d", Now, TheDate)
MsgBox Msg

You can also type a statement within a query, such asDateDiff("d", Date(),
StartDte)The reason I use Date() is because Now returns the time also with
the date. Date just returns the date."Dave Elliott"
<(E-Mail Removed)> wrote in message
news:d99ke.80$(E-Mail Removed)...
>i need to calculate the number of days between my control (StartDte) and
>the current date
> StartDte is in this format m/d/yy with ainput mask of 99/99/00;0;_
>
> the other unbound calculated field needs to show the number of days
> between the 2 values.
> other field is named (unbound) late
>
>
>



 
Reply With Quote
 
Dave Elliott
Guest
Posts: n/a
 
      23rd May 2005
why wont this give the difference between text463 and startdte ?
=DateDiff("d",[Text463],"StartDte")


"G. Vaught" <(E-Mail Removed)> wrote in message
news:eB$(E-Mail Removed)...
> Use the function DateDiff.
> Code versionDim TheDate As Date ' Declare variables.
> Dim Msg
> TheDate = InputBox("Enter a date")
> Msg = "Days from today: " & DateDiff("d", Now, TheDate)
> MsgBox Msg
>
> You can also type a statement within a query, such asDateDiff("d", Date(),
> StartDte)The reason I use Date() is because Now returns the time also with
> the date. Date just returns the date."Dave Elliott"
> <(E-Mail Removed)> wrote in message
> news:d99ke.80$(E-Mail Removed)...
>>i need to calculate the number of days between my control (StartDte) and
>>the current date
>> StartDte is in this format m/d/yy with ainput mask of 99/99/00;0;_
>>
>> the other unbound calculated field needs to show the number of days
>> between the 2 values.
>> other field is named (unbound) late
>>
>>
>>

>
>



 
Reply With Quote
 
John Vinson
Guest
Posts: n/a
 
      23rd May 2005
On Mon, 23 May 2005 01:42:21 GMT, "Dave Elliott"
<(E-Mail Removed)> wrote:

>why wont this give the difference between text463 and startdte ?
>=DateDiff("d",[Text463],"StartDte")


Because the eight-letter text tring "StartDte" is not a valid date.

Use [StartDte] instead to tell Access that it's a table field.

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
Calculate difference between current date & prior S Microsoft Excel Worksheet Functions 3 25th May 2010 02:14 PM
Calculate current date from fixed time? mandg Microsoft Excel Worksheet Functions 2 1st Jun 2006 03:26 PM
formula to calculate age using birth date and current date =?Utf-8?B?bGFsYWg=?= Microsoft Excel Worksheet Functions 2 20th Nov 2005 10:51 PM
date difference using current date is no date is entered =?Utf-8?B?QmV0c3lL?= Microsoft Access Queries 5 7th Apr 2005 04:53 PM
Q. Difference between today's date in a form, and a fixed date? Jim Jones Microsoft Access Form Coding 4 17th Feb 2004 09:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 PM.