Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Rounding up Problem 3

Status
Not open for further replies.

cneill

Instructor
Mar 18, 2003
210
0
16
GB
Hi,

The following part of the code is causing a problem

Dim EF As Double

EF = Me![£ForecastValue]

£ForecastValue is returning the correct value e.g. 1923.87
But EF is returning 1924
How do I get EF to return the same value with the decimal places?

Thanks for your help
cneill
 
I can't replicate your problem. I get two decimal places in both instances. Is there anything else in the data or formatting that might account for this?
 
Hi BTSTeam

the full part of the code at that point is
EF = Me![£ForecastValue] Or IsNull(Me![£ForecastValue])

when I remove Or IsNull(Me![£ForecastValue]) then
EF returns the decimal places if I include it it rounds it up.
Any thoughts?
Thanks
CNEILL
 
EF = nz(Me![£ForecastValue],-1)
 
BTW it is not rounding, it is "casting" the variant into an integer data type. Examples:

?2.5 or true
-1
?2.5 or 7
7
?2.5 or false
2


But even after that article I am not sure if I understand the following:
?2.5 or 7
7
?2.5 or 7.5
10
 
Hi MajP

EF = nz(Me![£ForecastValue],-1)
This has sorted it thanks

cneill
 


cneill,

I notice that over the past 7 years, you have posted some 27 threads and have received many good tips related to your stated needs. Yet, you have responded NOT ONCE, to
[blue]
Thank Tek-Tip Contributor
for this valuable post!
[/blue].

The [purple]little purple Stars[/purple] accomplish several important things.

First, it gives positive feedback to contributors, that their posts have been helpful.

Second, it identifies threads as containing helpful posts, so that other members can benefit.

And third, it identifies the original poster (that's YOU, BTW), as a grateful member, that not only receives, but is willing to give tokens of thanks.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top