Results 1 to 3 of 3
  1. #1
    andy1970 is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2012
    Posts
    3

    Issue with query in a form

    I am getting an error when trying to save that says index or primary key cannot contain a null value. I have a query built from the query builder. The first one works the second does not. The only difference is the second has a field from the tbl_Computer_Attributes table in the select. This is from Access 2007. There must be a limitation on the number of JOINS or how it updates the tables. Here is the SQL and the query schema:
    SELECT tbl_Hardware_Device.Device_ID, tbl_Hardware_Device.Product_ID, tblkp_Hardware_Info.Type, tbl_Device_Attributes.OE_Number


    FROM tblkp_Hardware_Info INNER JOIN (tbl_Harware_Product INNER JOIN ((tbl_Hardware_Device LEFT JOIN tbl_Computer_Attributes ON tbl_Hardware_Device.Device_ID = tbl_Computer_Attributes.Device_ID) LEFT JOIN tbl_Device_Attributes ON tbl_Hardware_Device.Device_ID = tbl_Device_Attributes.Device_ID) ON tbl_Harware_Product.Product_ID = tbl_Hardware_Device.Product_ID) ON tblkp_Hardware_Info.Hardware_Info_ID = tbl_Harware_Product.Hardware_Info_ID;

    SELECT tbl_Hardware_Device.Device_ID, tbl_Hardware_Device.Product_ID, tblkp_Hardware_Info.Type, tbl_Device_Attributes.OE_Number, tbl_Computer_Attributes.BIOAS
    FROM tblkp_Hardware_Info INNER JOIN (tbl_Harware_Product INNER JOIN ((tbl_Hardware_Device LEFT JOIN tbl_Computer_Attributes ON tbl_Hardware_Device.Device_ID = tbl_Computer_Attributes.Device_ID) LEFT JOIN tbl_Device_Attributes ON tbl_Hardware_Device.Device_ID = tbl_Device_Attributes.Device_ID) ON tbl_Harware_Product.Product_ID = tbl_Hardware_Device.Product_ID) ON tblkp_Hardware_Info.Hardware_Info_ID = tbl_Harware_Product.Hardware_Info_ID;
    Click image for larger version. 

Name:	schema.jpg 
Views:	10 
Size:	52.6 KB 
ID:	8181

  2. #2
    andy1970 is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2012
    Posts
    3
    I figured it out. The attribute tables cannot have the Device_ID as the primary key in the one to one relationship. Access pretty much forces you to have an autonumber as a primary key for each table.

  3. #3
    tanvi is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    100
    This error occurs when you executed a query that tried to put a Null value in a primary key field. To solve this issue, you must enter a value in the primary key field before moving to another record.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-14-2012, 10:31 AM
  2. Query Issue
    By mtnairco in forum Access
    Replies: 4
    Last Post: 07-22-2011, 10:46 AM
  3. Form / Query issue
    By asmith in forum Forms
    Replies: 4
    Last Post: 09-24-2010, 10:47 AM
  4. Please Help, Combo Box Query Form Table Issue
    By Keeyter in forum Programming
    Replies: 9
    Last Post: 04-29-2010, 09:15 PM
  5. Query Issue
    By access in forum Queries
    Replies: 1
    Last Post: 01-14-2010, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums