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-03 15:56:49
Message-ID: 745b6944-2562-66c8-d613-932b9b59ccd6@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

On 11/03/2016 08:39 AM, Vincenzo Turturro wrote:
> Il 03/11/2016 16:16, Adrian Klaver ha scritto:
>> On 11/03/2016 08:11 AM, Vincenzo Turturro wrote:
>>> Good morning
>>>
>>> I write in order to obtain clarification (and possibly a solution !)
>>> about a problem I can't solve.
>>>
>>> First of all I will briefly describe the scenario.
>>>
>>> I have several applications written in VBA (Visual basic for
>>> Application) using Microsoft Access both as backend and frontend (data
>>> are stored in mdb files on a server and applications are stored in mde
>>> files on the pcs).
>>>
>>> I'm committed in reingeneering these applications in order to migrate
>>> data files to a PostgreSQL database, without changing the frontends
>>> except that for the connection to the data they manage.
>>>
>>> The idea is to connect each frontend to Postgres DB (version 9.5.4)
>>> using ODBC (version 9.5.4).
>>>
>>> In order to run some tests, I migrated data from an mdb file to PG
>>> tables, defined an ODBC connection and linked the Access frontend to the
>>> PG database using it.
>>>
>>> The problem raises when the application needs to deal with data stored
>>> in boolean columns.
>>>
>>> If SW_UE is the name of a boolean column in a table, when I use a
>>> statements like this
>>>
>>> If SW_UE = -1 Then
>>>
>>> Do something
>>>
>>> End If
>>>
>>> the following error raises:
>>>
>>> ERROR: Operator does not exist boolean = integer
>>>
>>> I already searched the Internet for a solution and I found some, but
>>> none solved the problem.
>>>
>>> For this reason I decided to write here, hoping in your help and/or some
>>> hint.
>>
>> https://odbc.postgresql.org/docs/config.html
>>
>> Advanced Options 2/2 Dialog Box
>>
>> True is -1: Represent TRUE as -1 for compatibility with some
>> applications.
>>
>> While we are on bools:
>>
>> Advanced Options 1/2 Dialog Box
>>
>> Data Type Options: affects how some data types are mapped:
>>
>> Bools as Char: Bools are mapped to SQL_CHAR, otherwise to SQL_BIT.
>
> Thank you for your answer.
> I had already configured the ODBC driver as you suggested, long before
> writing the mailing list.

This was mentioned where in the original post?

> But it didn't work ... and the error continue to raise.

What is raising?:

ERROR: Operator does not exist boolean = integer

Why not do?:

If SW_UE = True

>
> Best regards
>
>>>
>>> I thank you in advance for any answer.
>>>
>>> Best regards
>>>
>>> ------------------------------------------------------------
>>> Vincenzo Turturro
>>>
>>> Regione Toscana
>>> Direzione generale Governo del territorio
>>> Sistema Informativo Territoriale ed Ambientale
>>>
>>> Via di Novoli 26
>>> 50127 Firenze
>>>
>>> Tel 055 43 83 855
>>> ------------------------------------------------------------
>>>
>>
>>
>
>

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

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Vincenzo Turturro 2016-11-04 11:52:13 Re: Problem in using PostgreSQL ODBC driver with VBA
Previous Message Fred Parkinson 2016-11-03 15:53:43 Re: Problem in using PostgreSQL ODBC driver with VBA