View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Using a bookmark and applying a switch to it

The following kinds of manoevre have been known to help:

{ SET mylocalnumber { MERGEFIELD mynumber } }
{ REF mylocalnumber \#0.00 }
{ QUOTE { MERGEFIELD mynumber } \#0.00 }
{ SET mylocalnumber { QUOTE { MERGEFIELD mynumber } } }

(All the "{}" pairs have to be the special field code braces you can insert
using ctrl-F9)

However, Word does sometimes have problems with certain types of numeric
data - e.g. "currency" type fields in Access databases have not always
behaved as you might hope. This could be another of those situations. If you
insert a plain { MERGEFIELD mynumber } field, what do you see?

Unfortunately, I don't currently have an Oracle DBMS to test things with,
but assuming you are getting your data "directly" from your Oracle database
(i.e., in Word 2000, via an Oracle ODBC driver), there are other things you
could try, e.g.
a. there may still be two Oracle ODBC drivers - one provided by Microsoft,
which takes you up to about Oracle 6 in compatibility terms but AFAIK can
read compatible type fields in later Oracle versions, and one provided by
Oracle (there are other third party drivers as well). Perhaps worth trying
both.
b. Also worth exploring any options in the ODBC driver configuration.
c. Using Word VBA and the OpenDataSource method you can issue SQL that may
be able to transform these numeric fields into something that Word can
handle. However, the length of the SQL statement is fairly limited (255 or
511 bytes or characters) and if you need to transform a lot of these numbers
the SQL may become too long.

This assumes that you cannot create your own views in Oracle to give you
exactly what you need.

Going a bit further, other potential solutions include:
a. getting the Oracle data via another route (e.g. a Jet linked table, or
via a csv format file)
b. using Word VBA and the Mailmerge objects to preprocess the data for each
record before it is merged
c. using Word VBA to do one merge per record and preprocess the data for
each record before it is merged.

Let's hope one of the early suggestions (or one of macropod's) does the
trick. otherwise, you will find macros that can do (c) if you search this
group using Google Groups, or I can post something here.

Peter Jamieson
"Mark" wrote in message
...
Hi.

I have an external application which merges data from an Oracle DB. We
need
to perform a switch on the data to reflect currency however, the available
/#
switches do not apply and, instead, the field is then returned blank.
Selecting F9 does not show the Mergefield codings.

What I am reduced to understanding is that the mergefields are as is
stored
in the DB and cannot be represented.

I saw a reference some time back to a process whereby the mergefield is
brought into another section of the document and Bookmarked. Then, I call
the
bookmark and apply the currency formatting to it instead of the
mergefield.
Can anyone refer me to an article which could explain how to do this or
perhaps, refer me to a sample VBA macro which can assist here.

Thanks in advance.