How to get rid of the decimal places in a report calsulation/text

G

Guest

For example, I want to have the report calculate a person's age - I did this
as follows: ([today] - [date of birth])/365 which produces ia number like:
50.1457899 -so in "properties" I made the number standard with 0 decimal
places - but now I get 2 decimal places: 50.62 - I'm guessing I need to add
something to the formatting expression...

Thanks for your help.

John

Here is the string:

=[annuity type1] & " - " & Format([benefit amount1],"Currency") & " " &
[payable1] & " " & [mode1] & " " & [guaranty1] & " " & [years1] & " " &
[years] & "" & [months1] & " " & [begon] & " " & [date of 1st payment1] & " "
& Format([BEG AGE],"Standard") & " " & [lastpymt] & " " & [date of last
payment1] & " " & Format([ending age],"Standard")
 
D

Duane Hookom

KARL,
Have you tried your expression? DateDiff() requires three arguments and you
provided only two. Even using
Age:DateDiff("y",Date(), [date of birth])
makes me -18719 years old.

John,
Dividing the number of days by 365 is also not very accurate. There are much
better calculations at http://www.mvps.org/access/datetime/date0001.htm.

You can format a numeric value to no decimal places using
Format([YourField],"0")
This will round up or down so you need to use an expression that returns an
integer.
--
Duane Hookom
MS Access MVP
--

KARL DEWEY said:
Why not use DateDiff?
Age:DateDiff("y",Date()-[date of birth])

jmuirman said:
For example, I want to have the report calculate a person's age - I did
this
as follows: ([today] - [date of birth])/365 which produces ia number
like:
50.1457899 -so in "properties" I made the number standard with 0 decimal
places - but now I get 2 decimal places: 50.62 - I'm guessing I need to
add
something to the formatting expression...

Thanks for your help.

John

Here is the string:

=[annuity type1] & " - " & Format([benefit amount1],"Currency") & " " &
[payable1] & " " & [mode1] & " " & [guaranty1] & " " & [years1] & " " &
[years] & "" & [months1] & " " & [begon] & " " & [date of 1st payment1] &
" "
& Format([BEG AGE],"Standard") & " " & [lastpymt] & " " & [date of last
payment1] & " " & Format([ending age],"Standard")
 
G

Guest

Thanks Karl - I can't seem to make this work - so you put this in the query
or the report? I get a message in reports is either "too many )" or "wrong
number of arguments...?

KARL DEWEY said:
Why not use DateDiff?
Age:DateDiff("y",Date()-[date of birth])

jmuirman said:
For example, I want to have the report calculate a person's age - I did this
as follows: ([today] - [date of birth])/365 which produces ia number like:
50.1457899 -so in "properties" I made the number standard with 0 decimal
places - but now I get 2 decimal places: 50.62 - I'm guessing I need to add
something to the formatting expression...

Thanks for your help.

John

Here is the string:

=[annuity type1] & " - " & Format([benefit amount1],"Currency") & " " &
[payable1] & " " & [mode1] & " " & [guaranty1] & " " & [years1] & " " &
[years] & "" & [months1] & " " & [begon] & " " & [date of 1st payment1] & " "
& Format([BEG AGE],"Standard") & " " & [lastpymt] & " " & [date of last
payment1] & " " & Format([ending age],"Standard")
 
D

Duane Hookom

Karl didn't provide a tested expression so don't use it.

--
Duane Hookom
MS Access MVP


jmuirman said:
Thanks Karl - I can't seem to make this work - so you put this in the
query
or the report? I get a message in reports is either "too many )" or "wrong
number of arguments...?

KARL DEWEY said:
Why not use DateDiff?
Age:DateDiff("y",Date()-[date of birth])

jmuirman said:
For example, I want to have the report calculate a person's age - I did
this
as follows: ([today] - [date of birth])/365 which produces ia number
like:
50.1457899 -so in "properties" I made the number standard with 0
decimal
places - but now I get 2 decimal places: 50.62 - I'm guessing I need to
add
something to the formatting expression...

Thanks for your help.

John

Here is the string:

=[annuity type1] & " - " & Format([benefit amount1],"Currency") & " " &
[payable1] & " " & [mode1] & " " & [guaranty1] & " " & [years1] & " " &
[years] & "" & [months1] & " " & [begon] & " " & [date of 1st payment1]
& " "
& Format([BEG AGE],"Standard") & " " & [lastpymt] & " " & [date of last
payment1] & " " & Format([ending age],"Standard")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top