If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Count Years
Hello,
I have a continuous form with the following fields, First Name, Last Name, Date Arrived. In the continuous form next to these fields I would like to add a field called Years that calculates how many years since they have arrived for example... First Name Last Name Date Arrived Years John Johnson 01/27/2008 2.1 How do I write the logic into the Years field? I would need it exact with one digit after the decimal as shown above, but not two digits after the decimal. In a report I would need similar logic but I would need the logic to determine how many years the person has been here based upon a date I put in a form in a field called "OnDate". In other words how many years between the date arrived and the date I put on a form. Can you please help me with this? Thanks. Iram/mcp |
#2
|
|||
|
|||
Count Years
On Sat, 27 Feb 2010 15:17:01 -0800, Iram
wrote: Hello, I have a continuous form with the following fields, First Name, Last Name, Date Arrived. In the continuous form next to these fields I would like to add a field called Years that calculates how many years since they have arrived for example... First Name Last Name Date Arrived Years John Johnson 01/27/2008 2.1 How do I write the logic into the Years field? I would need it exact with one digit after the decimal as shown above, but not two digits after the decimal. In a report I would need similar logic but I would need the logic to determine how many years the person has been here based upon a date I put in a form in a field called "OnDate". In other words how many years between the date arrived and the date I put on a form. Can you please help me with this? Thanks. Iram/mcp A calculated field in your query such as Years: Round(DateDiff("d", [Date Arrived], [Forms]!{YourFormName]![OnDate]) / 365.25, 1) should work. -- John W. Vinson [MVP] |
#3
|
|||
|
|||
Count Years
I did a calculated field in a query a long time ago,
Can you refresh my memory on how to do it exactly? Thanks. Iram/mcp "John W. Vinson" wrote: On Sat, 27 Feb 2010 15:17:01 -0800, Iram wrote: Hello, I have a continuous form with the following fields, First Name, Last Name, Date Arrived. In the continuous form next to these fields I would like to add a field called Years that calculates how many years since they have arrived for example... First Name Last Name Date Arrived Years John Johnson 01/27/2008 2.1 How do I write the logic into the Years field? I would need it exact with one digit after the decimal as shown above, but not two digits after the decimal. In a report I would need similar logic but I would need the logic to determine how many years the person has been here based upon a date I put in a form in a field called "OnDate". In other words how many years between the date arrived and the date I put on a form. Can you please help me with this? Thanks. Iram/mcp A calculated field in your query such as Years: Round(DateDiff("d", [Date Arrived], [Forms]!{YourFormName]![OnDate]) / 365.25, 1) should work. -- John W. Vinson [MVP] . |
#4
|
|||
|
|||
Count Years
On Sat, 27 Feb 2010 17:58:01 -0800, Iram
wrote: I did a calculated field in a query a long time ago, Can you refresh my memory on how to do it exactly? Open the query in design view. Find a vacant Field cell in the top row. Type the expression into that field cell; in this case just type or copy and paste Years: Round(DateDiff("d", [Date Arrived], [Forms]![YourFormName]![OnDate]) / 365.25, 1) into that cell, all on one line, replacing "YourFormName" with the actual name of the form that you are using. -- John W. Vinson [MVP] |
#5
|
|||
|
|||
Count Years
Cool Thanks that worked John!
I have a calculated field in a different query that I need to fix, why doesn' this work? Years: Round(DateDiff("d",[FechaEntroObra],Date())/365.25,1) I need a year count between the field "FechaEntroObra" and today's date. Thanks. Iram/mcp "John W. Vinson" wrote: On Sat, 27 Feb 2010 17:58:01 -0800, Iram wrote: I did a calculated field in a query a long time ago, Can you refresh my memory on how to do it exactly? Open the query in design view. Find a vacant Field cell in the top row. Type the expression into that field cell; in this case just type or copy and paste Years: Round(DateDiff("d", [Date Arrived], [Forms]![YourFormName]![OnDate]) / 365.25, 1) into that cell, all on one line, replacing "YourFormName" with the actual name of the form that you are using. -- John W. Vinson [MVP] . |
#6
|
|||
|
|||
Count Years
On Sun, 28 Feb 2010 21:23:01 -0800, Iram
wrote: Cool Thanks that worked John! I have a calculated field in a different query that I need to fix, why doesn' this work? Years: Round(DateDiff("d",[FechaEntroObra],Date())/365.25,1) I need a year count between the field "FechaEntroObra" and today's date. In what way does it "not work"? What happens if you build it up piecewise: first DateDiff("d", [FechaEntroObra], Date()), then the division, then the round? What's actually in the FechaEntroObra field - a date/time value as the name suggests, or is it perhaps a date in a Text field? -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|