Results 1 to 3 of 3
  1. #1
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Composite keys (2007)

    I cannot find how to set up a composite key.

    The fields I have are

    Unit Number -- Text filed -- PK
    tart Date -- Date/Time -- PK
    Length -- Number
    Renter Number -- Text

    How do I set up both the firswt fields (together) as a PK?

    Regards,
    Chuck Billow
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Composite keys (2007)

    In the Design of the table, select both fields before you click the key icon.

    I almost never user composite keys. I would add an autonumber field and make that the key.
    I can still create a unique index on the two fields without having them as the key.

    Why? You use the key to identfiy the record in code. Having a single number field makes the code much simpler.
    Having a date field as part of the key, makes the code a bit more complicated again.
    Regards
    John



  3. #3
    Uranium Lounger CWBillow's Avatar
    Join Date
    Jul 2002
    Location
    Las Vegas, NV USA
    Posts
    6,371
    Thanks
    78
    Thanked 12 Times in 11 Posts

    Re: Composite keys (2007)

    Makes good sense.

    Thanks John.

    Regards,
    Chuck
    -------------------------------------------------
    "Good judgment comes from experience, and experience - well, that comes from poor judgment."

    ~ A(lan) A(lexander) Milne (1882-1956)- "House at Pooh Corner"

Posting Permissions

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