Results 1 to 2 of 2
  1. #1
    michal_milena is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2012
    Posts
    1

    My first access database - new foreign key record

    Hello,

    I'm new here also I just stared to learn Access 2007, and unfortunatelly I have a silly problem. On study I learned SQL and somethimes I think that there everything seems to work a bit diffrent, I forgot many things and I meet with trivial problem. I know that for somebody who know the topic I will be a quicky and simply case, but I stuck here and can't resolve it. I projected and builded my whole first database (all tables), but when I wanted to test it and fill up I meet with my problem. I gonna cut my whole database to only 2 tables becouse there the is the whole thing. I have tables:

    Type_of_position:

    -idType_of_position (PRIMARY KEY)


    -Name_of_position (VARCHAR (255))
    -Comments (VARCHAR (255))

    Employee:

    - idEmployee (PRIMARY KEY)
    - First_name (VARCHAR (255))
    - Last_name (VARCHAR (255))
    - Locker_number (INT)
    - Position (VARCHAR (255)) ------- here I have a problem

    When I create a new record (fill up a new worker) I want to choose a name of position from available, and put it to this field. I tried many times and combinations, and the only thing I meet was that idType_of_position (Type of position Table) need to be the same as in Employee table (idEmployee) but of course it's not this what I want to be. Do I need to create a one more field in Employee table for example position_ref and then create a relationship beetwen this field and idType_of_position? I know only how to set in design view type of field to show a list of available values, but how to do that when I create a new employee I can choose one of the position type, and store name of this position in "position" field?. Of course I don't mean to combined as I did before (one ID from type of position to one ID of employee) becouse of course many employees can have this same position name. I suposse that everbody will know what I want, but I always writes to many yey, I would be really gratefuly for any advice, or help becouse I don't know how to do it.

    P.S. sorry for my language but I just still learn English
    Attached Thumbnails Attached Thumbnails 1.png  

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    Why save position name in Employees table - save the position type ID as it is the primary key in Position table. Why are Type_of_position_idType_of_position and Employee_sizes_idEmployees_sizes indicated as primary key fields?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-06-2012, 09:35 AM
  2. Replies: 10
    Last Post: 05-08-2012, 09:17 AM
  3. Replies: 2
    Last Post: 04-19-2012, 11:29 AM
  4. Replies: 2
    Last Post: 10-29-2011, 02:07 AM
  5. Replies: 1
    Last Post: 11-11-2010, 11:56 PM

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