Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jan 2003
    Toledo, Ohio, USA
    Thanked 0 Times in 0 Posts

    Updating record in table where key has changed.

    Access97 in Win98se

    I have an event registration application.

    When a user registers for an event they are assigned, to say, a bus for example.

    My EventEquipment table has the following key fields: EventID, EventEquipmentID (bus), and Group Assignment (bus number).

    I also have a GroupAssignment table keyed with the same fields but it also includes the RegistrationID in the key.

    My question is, how do I update the data (key) fields in the GroupAssignment record when, for instance, a person's registration is changed to assign them to a different bus?

    Is there an easy way to do this? Or must I save the original record values, delete the existing record and then re-add it with the new key values? Thanks in advance.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    The Netherlands
    Thanked 0 Times in 0 Posts

    Re: Updating record in table where key has changed.

    Assuming EventID, EventEquipmentID is the primary key of your table you have a problem! The only way to change the key is delete the record and insert a new one.
    If you want to change the EventEquipmentID you need to have a different primary key. Your table looks like this then:
    ID, EventID, EventEquipmentID, ....
    ID is your primary key and has become completely meaningless (as any primary key should be!); EventID, EventEquipmentID is your secondary key.
    Now you can change EventEquipmentID!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts