View Single Post
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default OLE DB Mailmerge Data connections

If I select OLE DB data source, I have a screen popping up twice
which ask
me to choose the type of separated value. Once the merge is done, I

have the
bug that all the 0s in my data source file are 12:00:00 AM ! However,

I did
the same thing with same Word mailmerge file and the same data source

on a
colleague's computer and I do not have this "bug". Also when I'm

switching
of records, it's really fast compared to the 2 other data connections I
tried.


If
Word Office Button-Word Options-Advanced-General-Confirm File Format
Conversion on Open
is checked, you see different behaviour when opening a text file than
when it is unchecked. When it is unchecked, you don'tget to choose the
connection type and if Word opens the file using its internal text
reader, you probably won't suffer from this particular problem. If it is
checked, you have to choose, and Word 2007 may only display "OLE DB
Database Files". You can check "Shw ALl" and try to select the Text
converter.

However, once you have successfully connected to the data source, Word
will /probably/ use the same method when it re-opens the mail merge main
document (not necessarily, because there are limitations on the OLE DB
method that may cause Word to use the text converter.

When Word opens the file using OLE DB, it uses the Jet (or ACE) OLE DB
provider (well, in earlier versions of Word it might use the Jet ODBC
driver). That tries to assign one of 5 data types to each column, and
coerce all values in the column to that type. My page at
http://tips.pjmsn.me.uk/t0003.htm describes what happens for Excel
files, but the situation is similar for delimited text files.

Programmatically, you can influence Word's behaviour when it opens the
file using OLE DB by using a SCHEMA.INI file in the same folder as the
data file to specify column type information, a field delimiter
character and a character set. I don't have time to post that stuff now
but a google groups search for Peter Jamieson schema.ini may help

And yes, you are right, Mailmerge typically works much faster with OLE
DB connections than connections via text file converters.

You might be better off loading your calculated data into an Access
table, which is actually likely to be more reliably read by both Word
and Excel (not so sure about the implicaitions for Excel though - I
think when you open such a table in Excel you will probably end up with
an Excel "table" which can be harder to work with than regular worksheets)

Peter Jamieson

http://tips.pjmsn.me.uk

On 20/01/2010 17:53, JPGaudreau wrote:
Hi,

I have an Access database which contains my raw data. With C#, I'm doing a
lots of calculations on these data.

I'm exporting these calculated data into a CSV file. But before exporting
these data I'm formatting them (in the language required for each record).
Once my calculated data have been exported, I doing a mailmerge with Word
2003. I'm using CSV because it's also easy to open it with Excel.

If I select OLE DB data source, I have a screen popping up twice which ask
me to choose the type of separated value. Once the merge is done, I have the
bug that all the 0s in my data source file are 12:00:00 AM ! However, I did
the same thing with same Word mailmerge file and the same data source on a
colleague's computer and I do not have this "bug". Also when I'm switching
of records, it's really fast compared to the 2 other data connections I
tried.

If I'm trying to format the mergefield in word (\# #,##0.00), I'm getting
the value 12 instead of 12:00:00 AM.
Also, when I'm doing the merge with the data source DDE or Text files, I'm
not getting this bug. However, like I said it's really slower than with OLE
DB.

Is that could a be driver problem ?

I'm also using CSV because all the data is preformatted and the CSV format
is a text format so I could use the OLE DB data connection and be much more
faster* ...

Anybody could help me please ?

Thanks

Jean-Philippe