VBA Recordset.AddNew and NOT NULL fields

From: "Brian Haney" <brian(at)cybernaut(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: VBA Recordset.AddNew and NOT NULL fields
Date: 1999-12-08 00:58:44
Message-ID: 001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

I have a PostgreSQL (6.5.2) table "vendors" with a serial primary key
"vendor_id".

When I try to add a new record from VBA (under Excel 97, SR-2a) I get

Run-time error 3155
ODBC -- insert on linked table '???' failed.

A review of the odbc log file shows that it was trying to execute the
following command:

INSERT INTO "vendors"
("vendor_id","vendor_name","contact_id","vendor_addr1","vendor_addr2","vendo
r_city","vendor_state","vendor_zip","vendor_country","vendor_email","vendor_
phone","vendor_fax","vendor_promo","vendor_promo_url","vendor_url","vendor_c
omments","last_modified")
VALUES(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
,NULL,NULL,NULL)

which of course fails since the primary key, vendor_id, cannot be null.

(The failure message from PostgreSQL was:
"ERROR: ExecAppend: Fail to add null value in not null attribute
vendor_id".)

I'm using the PostgreSQL ODBC driver 6.40.00.6 from Insight Distribution.

Is it possible to configure the driver or the recordset so it will not
attempt to insert a new record with all NULL values when I invoke the AddNew
method?

Brian Haney

Browse pgsql-interfaces by date

  From Date Subject
Next Message Assaf Arkin 1999-12-08 01:07:33 Transaction support in 6.5.3/JDBC
Previous Message Christian Hang 1999-12-07 21:53:58 ODBC and Large Objects, FAQ not working