Results 1 to 11 of 11
  1. #1
    jaypoppin is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    13

    Question Editing Primary Key in Split Database

    I've inherited the management of a relatively complex database (~15 related tables, union queries, &c.) that hinges on a few basic primary keys.



    I have split the database, and distributed the front end client to other users.

    The most important primary key is that assigned to each client. It takes the numerical form XXXX-XXX. Typically, the final three digits are 001. When the database was in its infancy, many of the first entries skipped these last three digits, and just entered XXXX-.

    It is now necessary to go back and make sure all entries are complete. They must have the last three digits. I tried going into the back end, and editing them straightforwardly, however, it tells me that it is 'related' and cannot be edited.

    Is there a way to edit these primary keys and have them push out to all the clients and forms etc?

    Much obliged,

    Jay

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    In the Relationship screen, edit the Relationship and turn on cascading updates.

  3. #3
    jaypoppin is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    13
    I just tried that, and chose "cascade update related fields," instead of "cascade delete related records."

    When I tried, I received the following error:

    "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."

    Should I try, "cascade delete related records"?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by jaypoppin View Post
    Should I try, "cascade delete related records"?
    The simple answer here is NO! How many tables have this PK as a FK in them?

  5. #5
    jaypoppin is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    13
    It is the primary key on one table, and sits on 5 other tables (one of which is a union query, not a table).

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    FYI, queries are just a string of SQL and some strategy. They take up very little room. So that makes 4 tables with this PK as a FK. I think it can be fixed with queries and appends.

  7. #7
    jaypoppin is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    13
    Quote Originally Posted by RuralGuy View Post
    FYI, queries are just a string of SQL and some strategy. They take up very little room. So that makes 4 tables with this PK as a FK. I think it can be fixed with queries and appends.
    How would I go about that?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How many records do not have the trailing 3 numbers in the PK field?

  9. #9
    jaypoppin is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    13
    Roughly 20% of maybe 500.

  10. #10
    KathyL is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    94
    Quote Originally Posted by jaypoppin View Post
    I've inherited the management of a relatively complex database (~15 related tables, union queries, &c.) that hinges on a few basic primary keys.

    I have split the database, and distributed the front end client to other users.

    The most important primary key is that assigned to each client. It takes the numerical form XXXX-XXX. Typically, the final three digits are 001. When the database was in its infancy, many of the first entries skipped these last three digits, and just entered XXXX-.

    It is now necessary to go back and make sure all entries are complete. They must have the last three digits. I tried going into the back end, and editing them straightforwardly, however, it tells me that it is 'related' and cannot be edited.

    Is there a way to edit these primary keys and have them push out to all the clients and forms etc?

    Much obliged,

    Jay
    Your database is small. I manage one with hundreds of tables, queries, forms, etc. I've lost count. Live, 24/7. I don't split the database, because I find it slows down processing by the client.
    Primary keys must be unique in terms of data for each record. You should be able to edit the data, and it's stored in just the one table. I don't know what you mean by "push out to all the clients". The clients should not have data at their local PC. I also do not use Microsoft's relationship model, it causes too many development issues/restrictions and wastes my time. I code (using VB) any edits to provide integrity to the data.

    Quote Originally Posted by jaypoppin View Post
    "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again."
    When you get this error, it means exactly that. You have two or more records with identical key values. Create a temporary query looking for duplicates to find them.

    Kathy, I.T. Consultant and Computer Science Instructor

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Though I do not agree with much of what KathyL said, the issue with the error is valid. Are you *certain* you are changing the PK to a unique value in *all* of the tables?

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

Similar Threads

  1. When should I split my database
    By jordanturner in forum Access
    Replies: 7
    Last Post: 09-14-2010, 07:12 AM
  2. How do you refer to primary key on split form?
    By techneophyte in forum Forms
    Replies: 3
    Last Post: 08-13-2010, 08:11 AM
  3. Split Database
    By smikkelsen in forum Database Design
    Replies: 4
    Last Post: 04-16-2010, 06:46 AM
  4. Split Database
    By pthoopth in forum Database Design
    Replies: 3
    Last Post: 11-09-2009, 03:37 PM
  5. database structure:primary key debate
    By MUKUDU99 in forum Database Design
    Replies: 0
    Last Post: 08-19-2008, 12:20 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