Help inserting record to PG with MS Access frontend

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • freeskier
    New Member
    • Oct 2006
    • 65

    Help inserting record to PG with MS Access frontend

    Hello,

    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
    Code:
    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."

    Code:
    CREATE TABLE person
    (
      personid serial NOT NULL,
      fname character varying(50),
      lname character varying(50),
      roleid bigint,
      CONSTRAINT person_pkey PRIMARY KEY (personid),
      CONSTRAINT person_roleid_fkey FOREIGN KEY (roleid)
          REFERENCES "role" (roleid) MATCH SIMPLE
    ) 
    
    CREATE TABLE sinfo
    (
      personid bigint NOT NULL,
      sid character varying(7) NOT NULL,
      CONSTRAINT stinfo_pkey PRIMARY KEY (personid),
      CONSTRAINT sinfo_personid_fkey FOREIGN KEY (personid)
          REFERENCES person (personid) MATCH SIMPLE
      CONSTRAINT sinfo_sid_key UNIQUE (fduid)
    )
    Thanks for your time
Working...