Re: Problem in using PostgreSQL ODBC driver with VBA

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: vincenzo(dot)turturro(at)regione(dot)toscana(dot)it, pgsql-odbc(at)postgresql(dot)org
Subject: Re: Problem in using PostgreSQL ODBC driver with VBA
Date: 2016-11-04 23:06:19
Message-ID: 00099613-bd6f-d0d1-38dd-060c05ddb8f7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On 11/04/2016 04:52 AM, Vincenzo Turturro wrote:
> Il 03/11/2016 16:53, Fred Parkinson ha scritto:
>> Been there done that.
>>

>
> I'm not writing a new application: I'm reingeneering an existing
> application (eventually the first of a set of ten) and I merely can't
> browse the thousands of lines of vba code in order to change all the
> "If" statements.
>
> Nor I can use the automatic "search and replace" function because the if
> statements can be of the type
>
> If BoolField = BoolVar then
> do something
> end if
>
> Nor I can change the type of all the boolean variables to Char.
>
> And I simply don't want even to think about the nightmare to dig all the
> SQL statements, which often are built in VBA "on the fly" according to
> user's choices ...
>
> Do you think I should evaluate another database, more "Access friendly" ?

So in the Access instance I have running successfully against Postgres
the ODBC Bools as Char is checked and True is -1 is not checked. One
thing I did run across, which I forgotten was the 32/64 bit problem.
The app is using the 32 bit ODBC driver whereas the default ODBC manager
in Control Panel is the 64 bit one. To get at the correct one I had to run:

https://odbc.postgresql.org/faq.html#6.8

%SystemRoot%\syswow64\odbcad32.exe

Could that be an issue in your case?

In your original post you say SW_UE is boolean column in the database.
Just to be sure, it is defined as boolean in the Postgres table?

The more I thought about it the more I was sure that:

If SW_UE = -1 Then

is not the problem. That comparison is being done in VBA(Access) and I
would think would raise a VBA error not the Postgres one you show. That
leads me to believe the issue is in:

Do something

End If

in particular the Do something part. That what is being returned to
Postgres is the problem. So what is being returned?

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Tsunakawa, Takayuki 2016-11-07 07:37:11 Re: [RFC] Changing the default of UseDeclareFetch and Protocol (statement -> transaction rollback)
Previous Message Adrian Klaver 2016-11-04 14:35:25 Re: Problem in using PostgreSQL ODBC driver with VBA