473,325 Members | 2,480 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,325 software developers and data experts.

Converting Dates to Months Calc on a form

9
I have a form where I have 2 dates:

06/27/2007
01/28/1996

What I need to get is the difference between the 2 dates in months.

Or in otherwords I am trying to get the age of the 2 dates in months.

Can anyone help me? Its been a while since I did this in on a form in Access 2003 and it might be simple and I am just probably missing something stupid.

Thank you!!!
Jul 5 '07 #1
5 1569
puppydogbuddy
1,923 Expert 1GB
I have a form where I have 2 dates:

06/27/2007
01/28/1996

What I need to get is the difference between the 2 dates in months.

Or in otherwords I am trying to get the age of the 2 dates in months.

Can anyone help me? Its been a while since I did this in on a form in Access 2003 and it might be simple and I am just probably missing something stupid.

Thank you!!!
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Jul 5 '07 #2
wespw1
9
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Thank you so much puppydogbuddy.

I knew it was something stupid I was missing. Worked like a charm!
Jul 6 '07 #3
NeoPa
32,556 Expert Mod 16PB
=DateDiff("m", #06/27/2007#, #01/28/1996#)

or you can refer to the texboxes on the form to make it more dynamic
=DateDiff("m", "#" & [txtDate1] & "#", "#" & [txtDate2] & "#")
Excuse me for interfering, but the latter form could more simply be done as :
Expand|Select|Wrap|Line Numbers
  1. =DateDiff("m", [txtDate1], [txtDate2])
Converting to literal strings should work equally well, but isn't necessary.
Jul 6 '07 #4
wespw1
9
Thank you Neopa for your input. I tried something similiar to what you had and the previous person and it worked great.

Thank you both again! It sometimes helps to get refreshers!
Jul 6 '07 #5
NeoPa
32,556 Expert Mod 16PB
No problem.
PDB provided the main article. I was just adding a comment to that.
Glad you got sorted anyway :)
Jul 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
26
by: Frank | last post by:
For my website i would like to display the age of my son in years, months, days and hours. For now i manage to get a result for totals. Like the total number of days. This is the beginning: ...
7
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19...
8
by: netsurfer | last post by:
Hi: Have a question on making the date automatically filled in by what the user enters in by the date at the top. The date entered at the top would most likely be on a Wednesday then I need...
22
by: mike | last post by:
If I had a date in the format "01-Jan-05" it does not sort properly with my sort routine: function compareDate(a,b) { var date_a = new Date(a); var date_b = new Date(b); if (date_a < date_b)...
6
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date Obtained and Date Of Expiry I want a further 3 columns...
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...
14
by: gorio | last post by:
I have a MySQL/PHP based page with a number of date fields that I would like the user to be able to run a script on to update the fields and then submit them for server processing. All my...
16
by: nsymiakakis | last post by:
Hi All, First let me start by saying, I absolutely love this site. I have an access database that records are keyed in including a date field. i.e. 3/4/07, 3/20/07, 4/10/07,4/18/07, 5/4/07... and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.