I am trying to use the following code for a mail merge -- please advise:
with oDoc.MailMerge
.OpenDataSource "",,,,,,,,,,,"PROVIDER=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\abc2.mdb","select * from contacts"
.Execute
The key is that I need to be able to connect to database without using ODBC.
Thanks,
Steve T
Cindy M -WordMVP- - 24 Mar 2005 12:05 GMT
Hi =?Utf-8?B?U3RldmVUcnVl?=,
> I am trying to use the following code for a mail merge -- please advise:
>
[quoted text clipped - 4 lines]
>
> The key is that I need to be able to connect to database without using ODBC.
Which version of Word? I take it you want to connect to an Access database?
Have you tried recording making the connection in a macro and using that code?
If you haven't, do so; if you have and it doesn't work, please describe
exactly how it's not working.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
SteveTrue - 24 Mar 2005 16:15 GMT
This is VBScript embedded in an ASP page.
I want to do the mail merge based on user input from the ASP page.
The database has to be assigned on the fly -- thus the requirement to use a
connect string at runtime -- I would like to use OLE DB to make the
connection to either an Access or MS SQL Server.
When I use the connection string from the code snippet in my first post, I
get a
dialog that says: Confirm Data Source - and presents a list of datasource
types.
When I choose OLE DB, the Word doc opens, but the ASP page gets the
following error message: Word was unable to open the data source.
It is very close to working, I just need help with the connect string to
Access or SQL Server using OLE DB.
Thanks again.
Steve T.
> Hi =?Utf-8?B?U3RldmVUcnVl?=,
>
[quoted text clipped - 19 lines]
> This reply is posted in the Newsgroup; please post any follow question or
> reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 26 Mar 2005 12:20 GMT
Hi =?Utf-8?B?U3RldmVUcnVl?=,
> When I use the connection string from the code snippet in my first post, I
> get a
> dialog that says: Confirm Data Source - and presents a list of datasource
> types.
> When I choose OLE DB, the Word doc opens, but the ASP page gets the
> following error message: Word was unable to open the data source.
Yes, and did you try what I suggested: recording making the connection in a
macro? Often, that will give you exactly the little piece in the puzzle that
you're missing...
FWIW, an OLE DB connection to Access is not optimal; there are issues with
OLE DB connections that use the JET driver. But you should be OK if this is a
one-off, throw away and your users have a US-EN setup, or won't be using the
original Word 2002 release.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)