View Single Post
  #3   Report Post  
Peter Jamieson
 
Posts: n/a
Default

Yes, unfortunately \*Cardtext only deals with whole numbers as you noticed.

To do better you would probably either need to split the number up into the
whole number and the fractional parts, and generate the exact wording you
need using more than one field. Alternatively, if the number of different
possible percentages is finite, and preferably small (e.g. because they can
only be 0.5, 1, 1.5, 2, up to a known maximum) then you might be better off
simply creating a sequence of IF fields, along the lines of

{ IF { MERGEFIELD myfield } = 5 "five percent (5%)" ""
}{ IF { MERGEFIELD myfield } = 5.5 "five and one half percent (5.5%)" ""
}

etc. Don't try to nest the fields as there is a limit of around 20 levels of
nesting.

My other problem is with numbers over one million, I'm trying to end up
with
something like "in the sum of One Million Dollars ($1,000,000.00)" This
has
worked for me with CardText and DollarText with numbers under a million,
but
not for large numbers.


As long as the pattern of words is the same for numbers above a million
(e.g. 999,000,000 should be written Nine hundred ninety nine million" - in
the UK we have an "and" which doesn't appear when you use
Cardtext/Dollartext) then you can try something like the following, which
should take you up to 999999999999

{ SET x { MERGEFIELD mylargenumber }
}{ SET r { =MOD(x,1000000) }
}{ SET m { =INT(x-r)/1000000)) }
}{ IF { m } = 0 "" "{ m \*Cardtext } million }" }{ r \Cardtext }

I think you can probably modify that if you need to use the word "billion"
:-)

Peter Jamieson


"JoyceA" wrote in message
...
Hello,
I'm merging some Access data into Word documents (2003 versions of both
Access and Word). I'm trying to use the CardText switch to spell out
some
numbers for two different purposes.

The first problem is with percentages that are not whole numbers. I am
trying to end up with something that goes " at a rate of five and one half
percent (5.5%) ". My switches work for whole numbers, but not fractions -
they get rounded up to the next whole number in the wording portion, not
the
number part - so the result is "at a rate of six percent (5.5%)".

My other problem is with numbers over one million, I'm trying to end up
with
something like "in the sum of One Million Dollars ($1,000,000.00)" This
has
worked for me with CardText and DollarText with numbers under a million,
but
not for large numbers.

Any suggestions would be greatly appreciated.

Thanks, Joyce