Results 1 to 5 of 5
  1. #1
    Eric_$ is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2023
    Posts
    2

    How to add a Primary Key to a linked table?

    Is it possible to add a primary key to a linked table? Sorry I am fairly day to access but I have a cell table that is linked and I need to be able to add certain information that correlates to each row and the Excel sheet. Is that even possible?

  2. #2
    Minty is online now VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Do you mean add a primary key to a linked excel sheet?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Eric_$ is offline Novice
    Windows 11 Access 2019
    Join Date
    Mar 2023
    Posts
    2
    Yes is there a way to add a primary key to a linked Excel table? Through a query? Right now I have it set up where my local table is linked to the Excel link sheet by a subform

  4. #4
    Minty is online now VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    There is no such thing as a Primary key in an excel sheet.
    Is there something in the sheet that uniquely identifies a single row, a combination of column values perhaps?

    If there are, you could import the sheet to a staging table then insert the new unique values to a table with Autonumber ID.
    Then export the details back out if you need the key in the excel sheet.

    Maybe take a step back and describe the purpose of the exercise without getting bogged down in the database details?
    There may be a better approach.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    agree there is probably a better approach - would also need to know if the value needs to be unique for just this one occasion or across all occasions. i.e. you are linked to a excel spreadsheet, say the first row of data is assigned in some way an ID of 1. Later down the line someone sorts the spreadsheet so 1 is still assigned to row 1, but this is now a different record.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-23-2016, 07:26 PM
  2. Replies: 3
    Last Post: 12-17-2015, 07:01 AM
  3. How to make a primary key on a linked table?
    By MarcoFromDowntown in forum Database Design
    Replies: 2
    Last Post: 03-04-2015, 04:19 PM
  4. Replies: 9
    Last Post: 10-20-2014, 04:00 PM
  5. Change a field to Primary key in linked table
    By MrFormula in forum Programming
    Replies: 4
    Last Post: 11-25-2011, 01:42 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