NToM(), MToN()
NTOM() and its counterpart,
MTON(), convert numeric values to currency and vice versa.
Usage
|
nNumeric = MTON( mCurrency )
mCurrency = NTOM( nNumeric )
|
Why the "M" in the function name, rather than a "C" for
Currency? Well, "C" is already taken as the type for Character
fields, so Microsoft chose "M" because it's one of the few
letters that doesn't occur in the word "currency." No, actually,
we suspect they chose it as shorthand for "Money." It's not
intuitive, however, and violates the rules used to name other
conversion functions, such as DTOT(), CTOD(), in that the type
abbreviation for currency ("Y") isn't in the function name.
Besides, we think that NTOY() and YTON() are cool names for
functions.These functions aren't always required. REPLACE
converts one to the other automatically. A literal number can be
expressed as currency by preceding it with the $ delimiter.
However, if you are performing heavy mathematics like interest
calculations, you'll want to convert your currency values to
numeric if digits beyond four decimal places are important—they
often are!
Example
|
REPLACE mMoneyField with NTOM(nNumerics)
nRatio = MTON(mDollars)/nNumeric
|
Back to Table of Contents
Copyright © 2002-2018 by Tamar E. Granor,
Ted Roche, Doug Hennig, and Della Martin. Click for license
.