Results 1 to 2 of 2
  1. #1
    freddawson is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    5

    Adding AutoNumber as a PrimaryID to an Existing Table

    I apologize for maybe not posting this question in the correct forum, but I wasn't quite sure how to categorize it. Also, I am an Access novice, so I'll try to explain my wants/needs as best as possible.



    I have a simple database that I inherited, that contains basic customer contact info. We want to start adding more functionality to the database, so I've done alot of research to learn about how to begin normalizing my data.

    The existing table does not contain a useful primary key, since we may have multiple individuals from the same company, companies with very similar names, etc.

    I would like to add an AutoNumbered field to use as a CustomerID/primary key, but I can't seem to find a way to do so. Here is what I've tried so far:
    • I have tried to add a field to the table, and make it an AutoNumber data type. When I do so, I can error message saying that I cannot make a field AutoNumber if any other field in the table already has data entered in it.
    • I have tried to create a new table containing only an AutoNumber PrimaryID field, and then import data from the existing table, but that just creates a 3rd table.
    • Lastly, I did some research here on the forum, and it seems to me I can accomplish this by usign queries, but I must admit I don't understand the process enough to pull it off.
    This seems like it should be a pretty simple process (for those who know what they're doing!), but I just feels like I'm missing something.

    Thanks in advance for any feedback.

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    Before you go through the trouble of adding a primary key, it would be better to get the new table structure set up first and then move your data into the new structure.

    You said that you have companies and people/contacts at those companies. That would require at least 2 tables

    tblCompany
    -pkCompanyID primary key, autonumber
    -txtCompanyName

    tblCompanyContacts
    -pkCompanyContactID primary key, autonumber
    -fkCompanyID foreign key to tblCompany
    -txtFName
    -txtLName

    The above is just a simple structure, what you ultimately need will depend on what other data you have or intend to have in the future. Could you please provide more details on that?

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

Similar Threads

  1. Replies: 3
    Last Post: 07-28-2011, 11:24 AM
  2. Adding columns to existing tables.
    By OrangePie in forum Access
    Replies: 1
    Last Post: 07-07-2011, 01:49 PM
  3. Adding records to existing table
    By Mclaren in forum Programming
    Replies: 5
    Last Post: 05-18-2011, 12:44 PM
  4. Importing existing Autonumber fields
    By prophecym in forum Import/Export Data
    Replies: 3
    Last Post: 02-05-2011, 09:59 AM
  5. Replies: 3
    Last Post: 11-02-2010, 10:15 AM

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