By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Help inserting record to PG with MS Access frontend

P: 65

Sorry for the newb question; I've spent a good amount of time trying to figure this out. I am fairly new to the Postgre world. I am currently in the process of upsizing several MS Access apps to a single PostgreSQL system; I will continue to use Access as the frontend. I have duplicated the table structure in Postgre and have successfully connected Access as a frontend to view data.

I am having trouble inserting a record into Postgre using Access. I am using a bound form with command button to insert to 2 tables with the event code
Expand|Select|Wrap|Line Numbers
  1. DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
I get the error message "ODBC--insert on a linked table 'sinfo' failed. ERROR: null value in column "personid" violates not-null constraint."

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE person
  2. (
  3.   personid serial NOT NULL,
  4.   fname character varying(50),
  5.   lname character varying(50),
  6.   roleid bigint,
  7.   CONSTRAINT person_pkey PRIMARY KEY (personid),
  8.   CONSTRAINT person_roleid_fkey FOREIGN KEY (roleid)
  9.       REFERENCES "role" (roleid) MATCH SIMPLE
  11. CREATE TABLE sinfo
  12. (
  13.   personid bigint NOT NULL,
  14.   sid character varying(7) NOT NULL,
  15.   CONSTRAINT stinfo_pkey PRIMARY KEY (personid),
  16.   CONSTRAINT sinfo_personid_fkey FOREIGN KEY (personid)
  17.       REFERENCES person (personid) MATCH SIMPLE
  18.   CONSTRAINT sinfo_sid_key UNIQUE (fduid)
Thanks for your time
Mar 25 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.