Results 1 to 5 of 5
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239

    join table form and main form

    Hello everyone,



    I have to link two tables with many to many relationship. Then I want to create main form with subform, where subform would show items in combobox from 3rd table for Main form record.

    In other words: When I open main form (based on 1st table), Autonumber field is ready to save record. In subform I want to have combobox with list of values from 3rd table, select It and then Access must link this Item to Main form record, automatically - via joined table.


    HOW on Earth can I do this, I've tried everything I can possibly remember but I cannot make this happen

    Please help !

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by Lukael View Post
    ...select It and then Access must link this Item to Main form record, automatically - via joined table...
    I don't see this happening. If you have a junction table, create a query to display the relevant records. If you need to add new records, you can use a combo. However, you will need to use VBA to append records to your junction table as well as the other two tables (using the value of the combo and another PK).

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    the forms will do all the work; presuming you have a form for each table - and the tables all have the proper cross referencing key fields as is appropriate..... then when you inset the first sub form into the main form the wizard is going to prompt for cross reference unless you have already defined it in table relationships then it won't need to.

    and likewise when you inset the 3rd form into the sub form - the same occurs....

    the data will all be properly cross referenced.

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by NTC View Post
    the forms will do all the work;...
    That is interesting, would you set the subform that is bound to the junction table to .Visible = False?

  5. #5
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2003
    Join Date
    Oct 2013
    Posts
    239
    Hi guys,

    thanks for response. I have managed to figure out my problems. I'm not used to Access and It's "record based structure".

    I did everything right, but couldn't figure why I can't enter data in subform. Solution was simple - I entered in subform on blank record, that's why I got error "Primary key cannot contain null value".

    I just added this in Form's load and CreateNewRecord_Button:
    Code:
    Me.TextboxName.Value = ""
    This creates new record Autonumber automatically, so you can write to Subform even on "blank" form, and records are saved in junction table, nowhere else.

    P.S.: Yes, I have a Subform with a combobox directing to list items from 3rd table.


    Thanks for all help to both of you !!!

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

Similar Threads

  1. Replies: 5
    Last Post: 09-02-2014, 10:07 AM
  2. Replies: 6
    Last Post: 11-30-2013, 02:41 PM
  3. Replies: 2
    Last Post: 11-13-2012, 02:11 PM
  4. Replies: 10
    Last Post: 08-09-2012, 06:55 PM
  5. Self Join Table Form Development
    By grizzly98 in forum Forms
    Replies: 1
    Last Post: 05-17-2012, 05:39 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