From: David Gardner <david.gardner@yucaipaco.com>
To: pgsql-odbc@postgresql.org
Subject: Re: ODBC problem with Microsoft Word and Excel
Date: Fri, 02 Mar 2007 15:23:30 -0800
Message-ID: <45E8B1F2.4020804@yucaipaco.com> (raw)
In-Reply-To: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop>
References: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop>
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
snipet:
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oMM As Word.mailmerge
'Start Word
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
' create new document
Set oMM = oWord.Documents.Add.mailmerge
End If
oMM.MainDocumentType = wdFormLetters
oMM.OpenDataSource Name:="", Connection:="DSN=DSNName",
SQLStatement:="SELECT * FROM mypgfunction(stuff)"
oMM.ShowWizard 1
oMM.EditMainDocument
Karl Denninger wrote:
>
> Ive 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
> connection.
>
>
>
> 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.
>
>
>
> Whats going on?!
>
>
>
> -- Karl Denninger karl@denninger.net <mailto:karl@denninger.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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: david.gardner@yucaipaco.com
Subject: Re: ODBC problem with Microsoft Word and Excel
In-Reply-To: <45E8B1F2.4020804@yucaipaco.com>
References: <00bc01c75d00$fcbd5c40$0d01a8c0@karlsdesktop> <45E8B1F2.4020804@yucaipaco.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox