I remember having problems with this. What I did was to move my query to
a pqsql function, and then pass Word the ODBC DSN with a SQL query of
"SELECT * FROM mypgfunction(parameter)". I also ran into a problem where
Word would see the column names correctly, and the row count would be
correct, but all the data fields were blank, I switched to using the
ANSI driver and that resolved it. Take a look at the following VBA code
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oMM As Word.mailmerge
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
' create new document
Set oMM = oWord.Documents.Add.mailmerge
oMM.MainDocumentType = wdFormLetters
oMM.OpenDataSource Name:="", Connection:="DSN=DSNName",
SQLStatement:="SELECT * FROM mypgfunction(stuff)"
Karl Denninger wrote:
> I’ve loaded the most recent ODBC driver off the Postgresql FTP site.
> The DBMS is functioning, has other applications (libpq, etc) operating
> perfectly, and the “Test” functionality from the “Data Sources” setup
> shows that I can connect to the database desired when I declare the
> However, when I attempt to go into either WORD (to use it as a mail
> merge source) or EXCEL (just for grins to pull data from there) I
> connect to “ODBC DSN”, click “PostgreSQL30W” (the driver that was set
> up in the Data Sources panel), I immediately get “Unable to get list
> of tables from the data source”.
> What’s going on?!
> -- Karl Denninger karl(at)denninger(dot)net <mailto:karl(at)denninger(dot)net>
> Diving? See http://www.scubaforum.org
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.5/707 - Release Date:
> 3/1/2007 2:43 PM
In response to
pgsql-odbc by date
|Next:||From: Frank Brown||Date: 2007-03-03 00:55:32|
|Subject: MSysConf on PG 8.2 ?|
|Previous:||From: Hiroshi Inoue||Date: 2007-03-02 22:51:29|
|Subject: Re: ByteA as LO parameter|