Re: Mergefield formatting codes seem to combine digits in numeric data

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If the explanations given here didn't help and you are still looking for a
solution, the problem /may/ be to do with the money type. There is certainly
a similar problem with the "currency" type used in Access/Jet in some
circumstances.

Something worth trying is to use a cast or convert function in a SQL Server
view to change the data type, or if you aren't in a position to do that, you
may be able to issue the necessary Transact-SQL in the SQLStatement
parameter of a Word VBA OpenDataSource call (and there may be other ways to
do it).

Peter Jamieson
<mdupris@xxxxxxxxxxx> wrote in message
news:1142984318.818313.111240@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
So I have a DOC file which mail merges from a SQL Server view. The
source data field is a SQL Server "money" type. It should display as a
dollar and cents value within Word. And it works fine except if there
is just a single non-zero digit to the right of the decimal point in
the raw data. If no formatting fields are supplied in the MergeField,
the data appears as 50.9, or 371.4, as I'd expect. However I've yet to
find a formatting for the mergefield which correctly dipslays the
missing trailing 0. Instead Word seems to combine digits. For instance
if the source data is 371.40, it displays as '375.00'; if the soruce is
50.9, it displays as 59.0 If the raw data has two digits to the right
of the decimal point however, e.g. 549.23, it displays correctly in
Word. I've tried innumerable varieties of format codes (\# $#,###.##,
\# $#,###.#0, \# $#,###.00, \# #,###,##0.00 \# $,0.00 \#$0.00 etc.
etc) with the same results each time. Anyone ever run into this before?
Even better, anyone know a solution? (Word 2003 / SP2 running on
Windows Server 2003, SP1; SQL Server 2000).

= Marchand =



.



Relevant Pages

  • Re: Mergefield formatting codes seem to combine digits in numeric data
    ... source data field is a SQL Server "money" type. ... If no formatting fields are supplied in the MergeField, ... Instead Word seems to combine digits. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Set based solution
    ... And SQL IS a data manipulation language, hence my problem with not using it ... that I had always used SQL Server to do data formatting for the past 12 ... instead of coding hooks in a dll to do this formatting, ... SQL, and T-SQL, is not a general purpose programming language. ...
    (microsoft.public.sqlserver.programming)
  • Re: Set based solution
    ... Pro SQL Server 2000 Database Design ... >> that I had always used SQL Server to do data formatting for the past 12 ...
    (microsoft.public.sqlserver.programming)
  • Re: Access vs SQL Date Weirdness = Incompatibility?
    ... There's no need to store formatting with the dates: ... I don't remember the details for SQL Server, but in Jet databases, ... other machines, regardless of what the Short Date format is on the other ... as dd/mm. ...
    (microsoft.public.access.formscoding)
  • Re: How to do this from DTS?
    ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... > The 05 records are built from a second table, where I do similar formatting> on the record, and then do an inner join on an orderid field that's in the> main table. ... > So when if I need to sort it, the orderid would force the 01's, 02's and> 05's for customer X together, as apposed to putting customer Y's data> intermingled with it. ...
    (microsoft.public.sqlserver.dts)