Re: ODBC problem with Microsoft Word and Excel

From: David Gardner <david(dot)gardner(at)yucaipaco(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: ODBC problem with Microsoft Word and Excel
Date: 2007-03-02 23:23:30
Message-ID: 45E8B1F2.4020804@yucaipaco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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:
>
> 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
> 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”.
>
>
>
> 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

Browse pgsql-odbc by date

  From Date Subject
Next Message Frank Brown 2007-03-03 00:55:32 MSysConf on PG 8.2 ?
Previous Message Hiroshi Inoue 2007-03-02 22:51:29 Re: ByteA as LO parameter