Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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


pgsql-interfaces by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group