Results 1 to 8 of 8
  1. #1
    JustinD's Avatar
    JustinD is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    3

    main & sub form

    hi,


    I am working on a required template for my company, the main form holds few information and the sub form have different details. both have different entry's.
    for a single entry in the main form details, it should also store multiple entrys of subform details.
    the table has been created but when try to add new records, the sub form does not go blank but still show the previous information.
    here is the screen shoot of the form.

    request all your help.

    Click image for larger version. 

Name:	form.png 
Views:	17 
Size:	85.5 KB 
ID:	29706

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How have you set the LinkChild/MasterFields properties of the SubFormControl?

  3. #3
    JustinD's Avatar
    JustinD is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    3
    Sorry i am not too good in access...
    with the youtube tutorials i created the below two tables -> using the from wizard i created the form...
    please guide me where i went wrong
    Main Table
    ID
    Customer_name
    Ourdc_no
    Challanno_date
    material

    Sub Table
    s_no
    operation
    furnace_media
    temp
    time
    hardness
    regd
    msrd
    remarks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you place the Main Table ID (hopefully an AutoNumber) in the Sub Table as a Foreign key (FK)?

  5. #5
    JustinD's Avatar
    JustinD is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    3
    ID is auto number primary key... which one has to set as Foreign key?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That same value needs to be in the 2nd table as a FK. Then Access can create the relationship for you. It is also the fields you will use in the LinkMaster/ChildFields properties of the SubFormControl.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is generally a good idea to name the PK field something significant so you can tell by the name where it came from. In your example it would be something like: MainPK. In the 2nd table the FK could then be name MainPK and you would know what it contains. The FK field needs to be a Long Integer if you had not already figured that out.

  8. #8
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Ummmmm....
    In the "Main table" (the one side), I might use something like "MainPK"
    In the other table (the many side), I might use "MainFK"...... so there wouldn't be two fields with a "PK" designation.

    But that is just the way I would name fields.......

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

Similar Threads

  1. Replies: 10
    Last Post: 07-05-2017, 11:31 AM
  2. Replies: 8
    Last Post: 03-20-2017, 07:22 PM
  3. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  4. Replies: 17
    Last Post: 08-22-2013, 08:22 AM
  5. Replies: 2
    Last Post: 11-13-2012, 02:11 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