Results 1 to 3 of 3
  1. #1
    wolfm is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2013
    Posts
    93

    subform will not link to main form

    I am struggling with something. I have a main form, called assets. It contains a part number, description and cost.

    I have a subform under it, called asset breakdown. It contains quantity, date received, and warehouse location. I created another lookup field, called “link to asset”, to tie the two forms together; via “link to asset” and “ID”-primary key, in assets.

    What I want is to have “link to asset” in the subform to automatically to be filled in with the ID-primary key, from ‘Assets’. When I enter into the subform, I need to manually add the ID for that asset, in the drop down box.

    To summarize:
    Main Form and Table--‘Assets’: ID part number description cost
    Subform and Table—‘Asset Breakdown’: ID quantity date received location link to asset
    I want to link: ‘Assets’:ID to ‘Asset Breakdown’:link to asset – automatically, without having to enter it.


    I have the appropriate relationship set up. I'm very stuck.
    Thank you!

  2. #2
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It doesn't sound like you have linked the main form and the sub form CONTROL.
    Double click on the sub form CONTROL, click on the data tab, look for "Link Master Fields" and "Link Child Fields".
    Click in one of the fields, then click on the ellipsis (the 3 dots "..."). Select the PK field and the FK field. Click OK.


    BTW, having "ID" as the PK field name for both tables is not a good idea.
    Maybe AssetID, Asset_ID or AssetID_PK would be better names
    For table "AssetBreakdown" (notice I removed the space - spaces in object names are BAD), maybe use AssetBreakdownID, AssetBreakdown_ID or AssetBreakdownID_PK (what I would use).

    Consider:

    Assets
    AssetID_PK (autonumber)
    PartNumber
    PN_Desc (Description is a reserved word in Access)
    Cost

    AssetBreakdown
    AssetBreakdownID_PK (autonumber)
    AssetID_FK (link to asset)
    Quantity
    DateReceived
    Location



    I created another lookup field,
    Lookup fields in TABLES are a bad thing to use. See
    The Evils of Lookup Fields in Tables
    http://access.mvps.org/access/lookupfields.htm

    The Ten Commandments of Access
    http://access.mvps.org/access/tencommandments.htm

  3. #3
    wolfm is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2013
    Posts
    93
    Great! It worked! Thanks so much for that, and the other pointers.

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

Similar Threads

  1. Link main form to subform
    By OllieCat in forum Forms
    Replies: 3
    Last Post: 05-12-2017, 06:01 AM
  2. Replies: 3
    Last Post: 01-05-2012, 07:15 PM
  3. Link main form with subform
    By lizzywu in forum Forms
    Replies: 1
    Last Post: 11-18-2011, 03:22 PM
  4. Replies: 3
    Last Post: 11-16-2011, 01:56 PM
  5. Replies: 2
    Last Post: 08-01-2011, 11:35 PM

Tags for this Thread

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