Results 1 to 4 of 4
  1. #1
    Ritequette is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2

    Relationship Help?

    This issue has been solved. Thanks, guys!

    Hi,

    I'm brand new to Access, and for the life of me, I cannot figure out how to create relationships right. I've created two tables that are supposed to share a common element: an ID number (using autonumber). When I go to create forms for these things, I'm supposed to drag one form onto the other. How it should work is that I add an element to the first form and then add elements to the embedded form beneath it, with each element being assigned the same ID number. The point of this is so that I can have one element correspond to multiple elements. For example, one person buying a bunch of different items. The problem I'm having is that the relationship isn't working. The ID numbers end up different between the two forms, and thus, a report shows that, for example, so-and-so bought only one thing when he actually bought six different things. I can't get the ID numbers to match up between the two tables. Can you guys help me out?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Both ID fields used in pk/fk relationship cannot be autonumber.

    The field in table of the 'one' side could be autonumber then field of the 'many' table would be just number (long integer) type. The 'many' table can have an autonumber field but it would not be involved in the pk/fk relationship. Why? Think about the meaning of 'auto' in autonumber. This field type automatically generates a number value when a record is created. This generated number cannot be obtained from a relationship link. However, the unique ID generated by the autonumber can be stored as a foreign key in another table (the 'many' side of relationshp).
    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.

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    I think you need to post ur DB . If you are wanting a subform in your main form (which your description above indicates) the relationships are one to many from your main form to your sub. Your sub has a parent child which must be set - also -
    tblMain. personID (primary key) will be autonumber tblSub. field (primary key) auto number and personFK (foreign key) number join these two in your relationship table

    in your sub form Link Master Field personID and Link Child Field personFK

    this might help you but I think give it a go then post your DB
    Good Luck (and persevere)

  4. #4
    Ritequette is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    2
    Thanks so much, June7! That was exactly the problem.

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

Similar Threads

  1. One to Many relationship
    By ramindya in forum Access
    Replies: 4
    Last Post: 02-10-2012, 01:59 PM
  2. Relationship
    By Navop in forum Database Design
    Replies: 1
    Last Post: 01-16-2012, 02:52 AM
  3. Replies: 5
    Last Post: 11-30-2011, 07:02 PM
  4. Relationship 1:1
    By MrLestat in forum Database Design
    Replies: 1
    Last Post: 05-18-2011, 07:13 AM
  5. Relationship
    By ClownKiller in forum Database Design
    Replies: 13
    Last Post: 12-21-2010, 05:49 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