Satement parameter in MailMerge.OpenDatabase

C

Christof Nordiek

i'm trying to make some MailMerge by automating word2003.
If i call MailMerge.OpenDataSource, what can i pass for the Satement
Parameter?
For Connectioninformation i'm using a *.odc file, wich connects to a
SQL-Server.
The name of the odc-file i pass as the Name parameter.

when I try
SELECT * FROM MyView
it fails.

SELECT * FROM "MyView"
succeeds.

Also passing the name of the view suceeds only with quotationmarks

What i'm trying to do is, passing a statement calling a table-valued
Function with parameters and/or a statement with a where clause containing
Filterconditions.

Does anyone know, how to do this?

Thanks
 
C

Cindy M -WordMVP-

Hi Christof,

Better place to ask this would be the Word.mailmerge.fields newsgroup. Peter
Jamieson, especially, has some idea and experience along these lines.

My basic recommendation would be to record making various connections and
setting specific filters from within the Word UI, then taking a look at what
the macro records. Word does have its own, very specific (finicky)
SQL-syntax.

FWIW, an OLEDB connection to SQL-Server should be using ANSI-92 for the SQL
statement, not ANSI-89 as with ODBC.
i'm trying to make some MailMerge by automating word2003.
If i call MailMerge.OpenDataSource, what can i pass for the Satement
Parameter?
For Connectioninformation i'm using a *.odc file, wich connects to a
SQL-Server.
The name of the odc-file i pass as the Name parameter.

when I try
SELECT * FROM MyView
it fails.

SELECT * FROM "MyView"
succeeds.

Also passing the name of the view suceeds only with quotationmarks

What i'm trying to do is, passing a statement calling a table-valued
Function with parameters and/or a statement with a where clause containing
Filterconditions.

Does anyone know, how to do this?

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

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