How to Fix Access Relationship Errors After Importing Excel Tables
Question details
The user needs to resolve relationship errors in Microsoft Access that occur when trying to link tables imported from Microsoft Excel.

- Product
- Microsoft Access, Microsoft Excel
- Device & OS
- not provided
- Scenario
- Importing existing spreadsheet data from Excel into Access tables and attempting to establish database relationships and enforce referential integrity.
- Observed behavior
- Access displays relationship errors indicating that linked fields do not have matching data types, field counts, or valid key values, preventing the relationships from being saved.
Verify that your imported Excel data does not contain blank rows or duplicate values in columns intended to be primary keys.
Match Data Types for Primary and Foreign Keys
Ensure that the foreign key field in the related table perfectly matches the data type of the primary key field.
The most common cause of relationship errors in Access is attempting to link fields with different data types. If the primary key is an AutoNumber, the corresponding foreign key in the related table must be set to a Number data type with a Long Integer field size.
Right-click the imported related table in the Navigation Pane and select 'Design View'.
Select your foreign key field. In the Data Type column, choose 'Number'. In the Field Properties pane below, set the 'Field Size' property to 'Long Integer'.
In the same Field Properties pane, ensure the 'Decimal Places' property is set to '0' to avoid invisible floating-point mismatches.
Navigate to Database Tools > Relationships. Drag the AutoNumber primary-key field from the parent table onto the corrected foreign-key field to establish the link.

Let Access Generate Clean Primary Keys
Use this solution if your imported Excel IDs contain invalid data, duplicates, or formatting errors.
Resolve Redundant Table Relationships
Fix transitive dependencies and database normalization issues that cause relationship conflicts.
Clean Your Spreadsheet Data Effortlessly with WPS Office
While Microsoft Access is strictly used for relational databases, ensuring your data is clean, properly formatted, and free of invalid IDs before importing is crucial. WPS Office offers a free, lightweight, and highly compatible alternative to Microsoft Excel, providing powerful tools to clean and structure your tables effortlessly.
- 1. Open data in WPS Spreadsheet: Launch WPS Office and open the Excel file you intend to import into Access.
- 2. Clean invalid entries: Use the 'Highlight Duplicates' and 'Remove Duplicates' tools under the Data tab to ensure all your ID columns are unique.
- 3. Format as pure text or numbers: Right-click your foreign key columns, select 'Format Cells', and strictly set them to 'Number' with 0 decimal places to prevent Access import errors.

Frequently Asked Questions
Why does Access say my data types are incompatible when creating relationships?
This happens if the linked fields do not share the exact same data type and field size. For instance, if you are linking to an AutoNumber primary key, the foreign key in the child table must be set to the Number data type with its Field Size property specifically set to Long Integer.
How do I enforce referential integrity between imported Excel tables?
To successfully enforce referential integrity, both tables must reside in the same Access database, the related fields must have matching data types, and there must be no orphaned records (e.g., a foreign key value that does not exist in the primary key column) in the related table.
What should I do if my imported Excel IDs contain decimals in Access?
In Access, open the table in Design View, select the ID field, ensure the Data Type is set to Number, and change the Decimal Places property from 'Auto' to '0'. Save the table and attempt to recreate the relationship.




