Hello,
Thank you in advance for any assistance.
I am trying to set up a mail merge from VB6/VBA code with Word 2000 using an ODBC data source (SQL 2000). I have successfully gotten the connection working using both a file dsn and a machine dsn. I am currently using a simple test merge template with fields <<FirstName>> (a nvarchar) <<Id>> (an int primary key).....plus a <<NextRecord>> field. The template doc itself has no data source attached. The code sets the data source upon calling the OpenDataSource method.
Here's the problem, when the document gets merged, the Id field merges correctly, however the FirstName does not. It just merges as a null string. I've jumped through all sorts of hoops to figure out what the problem is and here is what I've found:
-The same merge code performs correctly in Word 2007. Both the FirstName and the Id fields appear correctly in the merged document.
-Really weird: I am able to reproduce the problem in Word 2007 by leaving out the password in the DSN and being made to manually enter it at merge time. If I do that, I get a null string for the FirstName field.
-Adjusting the Format parameter of the OpenDataSource method makes no difference.
-I can view the result set correctly using the same DSN in MS Query, but upon merging into Word 2000, I still get the FirstName appearing as a null string.
-Any integer field type will merge correctly into Word 2000. Any nvarchar field type will merge as a null string.
Any ideas on how to get this merge working correctly?
Thanks again.