Mail Merge with Access 2003 database raises 'Confirm Data Source'window

S

Sebastian Daser

I am developing a VB6 application that is accessing an Access 2003 database. From within the application I want to be able to open a
Mail Merge Document that receives data from a database view (CISWORD) in the Access database.

Here is a simplified example of what I am trying to do in the VB6 application:
Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , , , , , _
"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\CIS.MDB;Mode=Read;", sQuery)
End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data Source' window pops up in Word, with the following selection:
- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error 5922: 'Word was unable to open the data source.'
When I select MS Access Databases via ODBC and afterwards the view CISWORD then the document shows the first record from the view
(which means it uses the query stored in the Mail Merge document, but not the one passed to the OpenDataSource method).

How can I prevent the 'Confirm Data Source' window from popping up and force Word to use the query passed to the OpenDataSource method?

If this is not possible with OLEDB I would also be fine with using an ODBC data source. I just don't want to use DDE.

Any help would be appreciated.

Thanks and kind regards,
Sebastian Daser
Infosystems Software & Service GmbH
sebastian.daser @ infosystems-gmbh.de
 
M

Mike

Sebastian,

Try changing:

sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ'"

to:

sQuery = "SELECT * FROM [CISWORD] WHERE (ContractNo = 'XYZ')"

Regards,

Mike

Sebastian Daser said:
I am developing a VB6 application that is accessing an Access 2003
database. From within the application I want to be able to open a
Mail Merge Document that receives data from a database view (CISWORD) in the Access database.

Here is a simplified example of what I am trying to do in the VB6 application:
Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , , , , , _
"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data
Source=C:\CIS.MDB;Mode=Read;", sQuery)
End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data
Source' window pops up in Word, with the following selection:
- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error 5922:
'Word was unable to open the data source.'
When I select MS Access Databases via ODBC and afterwards the view CISWORD
then the document shows the first record from the view
(which means it uses the query stored in the Mail Merge document, but not
the one passed to the OpenDataSource method).
How can I prevent the 'Confirm Data Source' window from popping up and
force Word to use the query passed to the OpenDataSource method?
If this is not possible with OLEDB I would also be fine with using an ODBC
data source. I just don't want to use DDE.
 
S

Sebastian Daser

Hi Mike,
Unfortunately the effect is still the same.
Any other idea?

Thanks and kind regards,
Sebastian.
Sebastian,

Try changing:

sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ'"

to:

sQuery = "SELECT * FROM [CISWORD] WHERE (ContractNo = 'XYZ')"

Regards,

Mike

I am developing a VB6 application that is accessing an Access 2003

database. From within the application I want to be able to open a
Mail Merge Document that receives data from a database view (CISWORD) in

the Access database.
Here is a simplified example of what I am trying to do in the VB6
application:

Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , , ,

, , _
"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data

Source=C:\CIS.MDB;Mode=Read;", sQuery)
End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data

Source' window pops up in Word, with the following selection:
- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error 5922:

'Word was unable to open the data source.'
When I select MS Access Databases via ODBC and afterwards the view CISWORD

then the document shows the first record from the view
(which means it uses the query stored in the Mail Merge document, but not

the one passed to the OpenDataSource method).
How can I prevent the 'Confirm Data Source' window from popping up and

force Word to use the query passed to the OpenDataSource method?
If this is not possible with OLEDB I would also be fine with using an ODBC

data source. I just don't want to use DDE.
Any help would be appreciated.

Thanks and kind regards,
Sebastian Daser
Infosystems Software & Service GmbH
sebastian.daser @ infosystems-gmbh.de
 
M

Mike

Try this: sQuery = "SELECT * FROM [CISWORD] WHERE ([ContractNo] = 'XYZ')"

Mike

Sebastian Daser said:
Hi Mike,
Unfortunately the effect is still the same.
Any other idea?

Thanks and kind regards,
Sebastian.
Sebastian,

Try changing:

sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ'"

to:

sQuery = "SELECT * FROM [CISWORD] WHERE (ContractNo = 'XYZ')"

Regards,

Mike

I am developing a VB6 application that is accessing an Access 2003

database. From within the application I want to be able to open a
Mail Merge Document that receives data from a database view (CISWORD) in

the Access database.
Here is a simplified example of what I am trying to do in the VB6
application:

Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , ,
,

, , _
"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data

Source=C:\CIS.MDB;Mode=Read;", sQuery)
End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data

Source' window pops up in Word, with the following selection:
- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error
5922:

'Word was unable to open the data source.'
When I select MS Access Databases via ODBC and afterwards the view
CISWORD

then the document shows the first record from the view
(which means it uses the query stored in the Mail Merge document, but
not

the one passed to the OpenDataSource method).
How can I prevent the 'Confirm Data Source' window from popping up and

force Word to use the query passed to the OpenDataSource method?
If this is not possible with OLEDB I would also be fine with using an
ODBC

data source. I just don't want to use DDE.
Any help would be appreciated.

Thanks and kind regards,
Sebastian Daser
Infosystems Software & Service GmbH
sebastian.daser @ infosystems-gmbh.de
 
S

Sebastian Daser

Hi Mike,
Sorry to come back to you late, but I was stretched to length with other things and did not check news.
I have tried what you suggested, but the problem persists.

Thanks and best regards,
Sebastian.
Try this: sQuery = "SELECT * FROM [CISWORD] WHERE ([ContractNo] = 'XYZ')"

Mike

Hi Mike,
Unfortunately the effect is still the same.
Any other idea?

Thanks and kind regards,
Sebastian.

Sebastian,

Try changing:

sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ'"

to:

sQuery = "SELECT * FROM [CISWORD] WHERE (ContractNo = 'XYZ')"

Regards,

Mike



I am developing a VB6 application that is accessing an Access 2003

database. From within the application I want to be able to open a


Mail Merge Document that receives data from a database view (CISWORD) in

the Access database.


Here is a simplified example of what I am trying to do in the VB6

application:


Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , ,
,
, , _


"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data

Source=C:\CIS.MDB;Mode=Read;", sQuery)


End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data

Source' window pops up in Word, with the following selection:


- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error
5922:
'Word was unable to open the data source.'


When I select MS Access Databases via ODBC and afterwards the view
CISWORD
then the document shows the first record from the view


(which means it uses the query stored in the Mail Merge document, but
not
the one passed to the OpenDataSource method).


How can I prevent the 'Confirm Data Source' window from popping up and

force Word to use the query passed to the OpenDataSource method?


If this is not possible with OLEDB I would also be fine with using an
ODBC
data source. I just don't want to use DDE.


Any help would be appreciated.

Thanks and kind regards,
Sebastian Daser
Infosystems Software & Service GmbH
sebastian.daser @ infosystems-gmbh.de
 
S

Sebastian Daser

Hi Mike,
Sorry to come back to you late, but I was stretched to length with other things and did not check news.
I have tried what you suggested, but the problem persists.

Thanks and best regards,
Sebastian.
Try this: sQuery = "SELECT * FROM [CISWORD] WHERE ([ContractNo] = 'XYZ')"

Mike

Hi Mike,
Unfortunately the effect is still the same.
Any other idea?

Thanks and kind regards,
Sebastian.

Sebastian,

Try changing:

sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ'"

to:

sQuery = "SELECT * FROM [CISWORD] WHERE (ContractNo = 'XYZ')"

Regards,

Mike



I am developing a VB6 application that is accessing an Access 2003

database. From within the application I want to be able to open a


Mail Merge Document that receives data from a database view (CISWORD) in

the Access database.


Here is a simplified example of what I am trying to do in the VB6

application:


Private Sub Command1_Click()
Dim sQuery As String
sQuery = "SELECT * FROM `CISWORD` WHERE ContractNo = 'XYZ' "

Dim oDoc As Word.Document
Set oDoc = Word.Documents.Add("C:\Contract Note.doc")

Call oDoc.MailMerge.OpenDataSource(gsMainDB, , , True, False, , , ,
,
, , _


"Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data

Source=C:\CIS.MDB;Mode=Read;", sQuery)


End Sub

The problem is that during execution of OpenDataSource a 'Confirm Data

Source' window pops up in Word, with the following selection:


- OLE DB Database Files
- MS Access Databases via DDE
- MS Access Databases via ODBC
- Xtreme samples Databases via DDE
- CISTEST via ODBC

When I select OLE DB Database Files I am receiving a run-time error
5922:
'Word was unable to open the data source.'


When I select MS Access Databases via ODBC and afterwards the view
CISWORD
then the document shows the first record from the view


(which means it uses the query stored in the Mail Merge document, but
not
the one passed to the OpenDataSource method).


How can I prevent the 'Confirm Data Source' window from popping up and

force Word to use the query passed to the OpenDataSource method?


If this is not possible with OLEDB I would also be fine with using an
ODBC
data source. I just don't want to use DDE.


Any help would be appreciated.

Thanks and kind regards,
Sebastian Daser
Infosystems Software & Service GmbH
sebastian.daser @ infosystems-gmbh.de
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top