query-formula-numbers

S

Steph Fryer

I'm working on a query, it pulls a field that is actually a dollar amount,
that looks like any of these examples:

1254.2502ffffffffff
12.25fffff
1200.2351fffffffff
10.02
123.05fffffffff

Basically the dollar amount can be anywhere from 1 dollar to a couple of
thousand. After the decimal it can be anywhere from two places to a bunch of
digits and then normally it's padded with fffffff at the end. I need this to
be a number with only two places after the decimal.

Any help is greatly appreciated.
 
T

Tom van Stiphout

On Thu, 26 Mar 2009 05:06:01 -0700, Steph Fryer

Use a combination of InStr, Mid, Left to find the decimal point. Then
return everything from two positions to the right of that.

-Tom.
Microsoft Access MVP
 
J

John Spencer

You could try
Val(SomeField)
to return a number
and then round that to two digits.
Round(Val([SomeField]),2)

Of course one problem with that is the field must have a value.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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