Forum Discussion

lwoodsusa's avatar
lwoodsusa
Copper Contributor
Jun 26, 2021

Can't setup Referential Integrity

I created a DB with two tables:

Property table

     propID     autonumber primary key

     address    short text

     city           short text

     state         short text

 

Residents table

    resID        autonumber  primary key

    propID     large number

   nameLast  short text

   nameFirst short text

 

I setup a one-many relationship between propID (Property table) and propID (Residents table).

BUT when I check the Referential Integrity checkbox in the dialog on the Relationships page, I get the following error "Relationship must be on the same number of fields with the same data type."

Both "propID" fields ARE the same data type.  

How do you set up Referential Integrity  (I never had this problem with earlier versions of Access)

  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    lwoodsusa 

    Your post shows that the field called propID in the Residents table is a "large number". Large Number is a different data type from "Long Integer". The AutoNumber propID in the Property table is a Long Integer, not a Large Number. Change the datatype to Long Integer for that field in the Residents table.

     

    • lwoodsusa's avatar
      lwoodsusa
      Copper Contributor

      George_Hepworth Thanks.  Yes, I know that the indexes are long integer but I haven't run into this "Large Number" so I took a guess---wrongly.

       

      Thanks much.

       

      Larry Woods

      • George_Hepworth's avatar
        George_Hepworth
        Silver Contributor

        lwoodsusa I'm glad you were able to sort it out.

         

        The Large Number datatype was added for compatibility with SQL Server's BigInt datatype. If you have not worked with a SQL Server back end, though, it might not have been something you'd take note of.

         

Resources