Access 2 Fields Relationship

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Miguel E
    New Member
    • Oct 2011
    • 1

    #1

    Access 2 Fields Relationship

    Hi and thank you for reading this,

    Situation:
    I have 2 tables. On Table1 and on Table2 I have 2 fields (one where I define a name of a movie theater as string and the other one where I define the # of the screen of that movie theater). How can I make a relationship taking into account both fields (columns)?

    Note: please take into account that I do not want to create a new field to concatenate those 2 fields.

    Thanks in advance!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    From that position you can't Miguel. It sounds like you're a little confused as to how this works so I'll try to lay down some basic guidelines :
    1. Start with two tables. In this case I suspect you have one table for theatres and a separate one for screens. For our purposes we'll call the [tblTheatre] and [tblScreen].
    2. Each table should have a unique Primary Key or Index (PK), but far better not a text field. Names or descriptions are particularly worth avoiding due to the problems they can introduce, as well as the extra overhead/delays introduced to handle larger amounts of data (An AutoNumber or Long Integer field takes up eight bytes for each entry).
    3. When linking these two tables together, and this will normally be done using a one-to-many relationship, it is necessary for one of the tables to duplicate the key of the other. That is to say the second table ([tblScreen] in our case) would contain a field that matches the PK of [tblTheatre]. It would also have it's own separate PK, which again should preferably be a Long Integer field.
    4. A match is determined by having the same [tblTheatre] PK value in both the PK of [tblTheatre] as well as the matching Foreign Key (FK) of [tblScreen].


    I hope that clears the issue up for you Miguel.

    Comment

    Working...