473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Compute Difference in Dates in Access

HI,

I have an Access novice and I have a question.I have a form that has a
request date that a user enters. What I need is when you click on a
command button, say Elapsed Time, it should give (via messge box or as
data in a text box) the difference between the request date and the
current day.

Eg : Request Date- 02/02/2003 and assuming current date is 02/02/2007
Elapsed Time - 4 years.
This information doesnt get stored in the database and needs to
execute everytime you click the command button. Also, the message must
be displayed before the rest of the information on the form is filled
out.Please let me know how to do this.

Thanks in advance

Feb 16 '07 #1
1 2015
On 16 Feb 2007 08:08:27 -0800, sh***************@gmail.com wrote:
HI,

I have an Access novice and I have a question.I have a form that has a
request date that a user enters. What I need is when you click on a
command button, say Elapsed Time, it should give (via messge box or as
data in a text box) the difference between the request date and the
current day.

Eg : Request Date- 02/02/2003 and assuming current date is 02/02/2007
Elapsed Time - 4 years.
This information doesnt get stored in the database and needs to
execute everytime you click the command button. Also, the message must
be displayed before the rest of the information on the form is filled
out.Please let me know how to do this.

Thanks in advance
Look up the DateDiff function in VBA help.
In Years?
Code the command button click event:
MsgBox DateDiff("yyyy",[RequestDate],Date())

In Days?
MsgBox DateDiff("d",[RequestDate],Date())

or to display in a text control, add an unbound control to the form.
Set it's control source to:
= DateDiff("yyyy",[RequestDate],Date())

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Feb 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ashish Sheth | last post by:
Hi All, In C#, How can I get the difference between two dates in number of months? I tried to use the Substract method of the DateTime class and it is giving me the difference in TimeSpan,From...
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
8
by: helpless | last post by:
Access 2003 - I am trying to calculate the difference between a specific date 5/1/2007 (not in a data field) and other dates that ARE in a field called Birth Date. I am trying to have it fill into...
22
by: MLH | last post by:
If 3 things can be in one of 2 states, the number of possible combinations is equal to 2^3. But if I have 3 things, 2 of which can be in 2 states and the other in 3 states, what's the simplest...
2
gchq
by: gchq | last post by:
Hi there I am attempting to compute some values from a DataTable. It works fine as long as there is a value to retrieve, otherwise it blows out! This will work as there are valid dates:- ...
2
by: Blackmore | last post by:
I am trying to use javascript to calculate the difference between two form inputted dates and return the result to another form object. When I load up the page with the function on my web browser...
8
by: Claudia Fong | last post by:
Hi, In VB we have DateDiff to calculate the days difference between 2 dates, I was wondering if we have something like that in C#? I want to calculate for example the days difference...
3
by: RobinDiederen | last post by:
Hi All, I have to tables with an identical structure. I want to compute the difference between this tables (probably by using some SQL statement). Question is, how to do so? Layout of the...
6
by: W. eWatson | last post by:
That's the question in Subject. For example, the difference between 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 03/03/2008 is 4, leap year--extra day in Feb. I'm really...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.