Reply
 
Thread Tools Display Modes
  #1   Report Post  
SteveTrue
 
Posts: n/a
Default Database Connect String

I am trying to use the following code for a mail merge -- please advise:

with oDoc.MailMerge
.OpenDataSource "",,,,,,,,,,,"PROVIDER=Microsoft.Jet.OLEDB.4.0;Dat a
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

  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?U3RldmVUcnVl?=,

I am trying to use the following code for a mail merge -- please advise:

with oDoc.MailMerge
.OpenDataSource "",,,,,,,,,,,"PROVIDER=Microsoft.Jet.OLEDB.4.0;Dat a
Source=c:\abc2.mdb","select * from contacts"
..Execute

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 :-)

  #3   Report Post  
SteveTrue
 
Posts: n/a
Default

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.

"Cindy M -WordMVP-" wrote:

Hi ?B?U3RldmVUcnVl?=,

I am trying to use the following code for a mail merge -- please advise:

with oDoc.MailMerge
.OpenDataSource "",,,,,,,,,,,"PROVIDER=Microsoft.Jet.OLEDB.4.0;Dat a
Source=c:\abc2.mdb","select * from contacts"
..Execute

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 :-)


  #4   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?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 :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm having trouble merging Word document with MS Works database. Caroline1013 Mailmerge 1 March 9th 05 10:40 AM
How do I renumber a database (w/hidden rows) to make it sequencial DWH Mailmerge 1 January 28th 05 04:08 PM
How to remove Database link in Merged to New Document WordHazIt Mailmerge 3 January 12th 05 03:44 AM
Mail Merge - DataPerfect database to Word DustyD Mailmerge 1 January 8th 05 09:49 AM
Mailing List from an Access Database RJP Mailmerge 1 December 11th 04 09:06 PM


All times are GMT +1. The time now is 06:45 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"