Simple way of storing Access booleans (Yes/No) fields

From: Kevin Bailey <kbailey(at)freewayprojects(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Simple way of storing Access booleans (Yes/No) fields
Date: 2006-09-27 22:21:56
Message-ID: 451AF984.1010605@freewayprojects.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
PG version 7.4 and Access version 2003.<br>
<br>
Its the old Access boolean issue which needs as simple an answer as
possible?<br>
<br>
<br>
I have a client where many users were running off the same Access
database which obviously got corrupted and recently failed completely.<br>
<br>
After finding a backup the data has been moved to a Postgresql DB
running on a Debian stable server.<br>
<br>
The data was exported via ODBC and I've tidied up the
autonumber-to-sequence issue.&nbsp; The original Access tables were renamed
to tablebnname_old and the new Postgresql tables have been set up as
linked tables with the original names.&nbsp; Most of the application is
working fine.<br>
<br>
Seems like only one issue remains.<br>
<br>
On a couple of forms there are check boxes and radio buttons which
linked originally to Yes/No (i.e. Boolean) fields in the original
Access table.<br>
<br>
I have a fairly free hand to sort this out - and there are only 4
tables which contain boolean fields and I can alter the Access
application as I see fit.<br>
<br>
There are quite a few queries (dozens) but again I can ask them to cut
them down and re-write needed queries if necessary.<br>
<br>
What is the simplest way forward?<br>
<br>
What should the ODBC connection be set as?<br>
<br>
Here are some possible scenarios.<br>
<br>
1. Should I set the fields to be int2 data type and then set the ODBC
driver to not treat bools as char but treat -1 as true.&nbsp; <br>
<br>
Will queries written in Access then run correctly?&nbsp; I thought I'd tried
this and it didn't work possibly because I did not relink the table.<br>
<br>
2. If I simply uncheck the treat bools as char option will the data be
saved correctly as booleans - will the ODBC driver be ok with the data
- i.e. reading and writing.<br>
<br>
3. Should I simply set the field as a char(1) and then in Access
somehow or other set the check boxes to save the data as 't' or 'f'.&nbsp;
How would the control do with reading the data.<br>
<br>
4. I understand there may be some extra functions which may be added to
PG to get Access play properly - is there a simple function which can
be added.&nbsp; Is there a well documented, proven and established method to
acheive this.<br>
<br>
5. Have these methods been 'tried and tested'<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.mail-archive.com/pgsql-docs(at)postgresql(dot)org/msg01563.html">http://www.mail-archive.com/pgsql-docs(at)postgresql(dot)org/msg01563.html</a><br>
<a class="moz-txt-link-freetext" href="http://community.seattleserver.com/viewtopic.php?p=8&sid=3add118a6924da03531fcbbbcc2c3ca8">http://community.seattleserver.com/viewtopic.php?p=8&amp;sid=3add118a6924da03531fcbbbcc2c3ca8</a><br>
<a class="moz-txt-link-freetext" href="http://www.mrayyan.com/?p=42">http://www.mrayyan.com/?p=42</a><br>
<br>
6. Change the check boxes to combo boxes - the form is horribly
cluttered but the following seems like a simple answer.<br>
<br>
<pre><font face="Arial, Helvetica, sans-serif">The way I have handled this is to avoid check boxes and use a combo box
instead. I supply the values as True;1 ,False;0 and bind the field to the
second value of each pair. To make things easier for data entry I hide the
second column by giving it a width of 0". In my DSN settings I check bool as
char and uncheck true as -1.
--
Adrian Klaver

aklaver ( at ) comcast ( dot ) net</font></pre>
<br>
There are however dozens of queries and many of them use booleans which
then may not work - however, if
needed I can ask the client to remove the unneeded queries and I could
then re-write the existing queries to take into account the new field.<br>
<br>
Maybe I should create the field as int2 and in the combo box have the
bound fields as -1 (label True) and 0 (label False).&nbsp; Maybe this way
the existing Access queries would work ok without changes?<br>
<br>
<br>
<br>
<br>
Any thoughts would be gratefully received.<br>
<br>
Kevin<br>
</body>
</html>

Attachment Content-Type Size
unknown_filename text/html 4.1 KB

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Philippe Lang 2006-09-28 06:48:22 Re: Simple way of storing Access booleans (Yes/No) fields
Previous Message noreply 2006-09-27 08:24:13 [ psqlodbc-Bugs-1000741 ] odbc: Don't insert into method that my query.