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

    Joined table problem

    Hello,

    I have joined table and when I create a subform for main form and enter data, this record is being also added in 3rd table, not just linked table...

    My tables:

    Programme
    ProgrammeID(PK)
    Programme name

    Programme-Location
    ProgrammeId(FK)
    LocationID(FK)


    Location
    LocationID(PK)
    Address

    My subform is created through query of ProgrammeID from table Programme-Location, and Address from table Location.



    When I enter data in subform, records are also saved in LocationID(PK), which is not OK since in my subform there is a combobox where records from Address are shown, so they increase their value. I also
    receive Error : "cannot add record, join key of table is not in recordset" What am I doing wrong ?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    you dont need tLocation in the join. That is just a lookup table to fill the field.

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

    then how must I create join table ? I still need a relationship to between tables, I have many to many right now.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Not quite sure what is wrong with your form/subform.

    Maybe this example will help.
    You can add new programmes in the main form.
    Have to use a different form to add new addresses to the address table or edit the table directly.

    BTW, this is in A2K format......

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

    Thanks for providing sample, but this is not what I wanted, but I have managed to solve my problem.

    My problem:

    My main form is for entering programme names and It's location on PC. That's what you posted in sample, but my form starts with a blank table record, and you can only view addresses in Subform Comboboxes, from 3rd table.

    So, If you have blank record, Autonumber is not set, and when entering in Subform you receive error :"Primary key cannot contain null value".

    All I did was to set one textbox field .value="" in form's load_event and now everything works - all data is writen directly to junction table, without any errors and adding records in table Location.


    Thanks for help !!

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Would need to see your dB, but it sounds like the link between the main form/sub form are not set.

    Great that you finally found the solution.

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

Similar Threads

  1. Link one table to 2 already joined tables
    By GabrielloG in forum Database Design
    Replies: 10
    Last Post: 12-17-2014, 05:00 PM
  2. Replies: 8
    Last Post: 10-03-2013, 08:11 AM
  3. Lookup name in a query on a non-joined table
    By karmacable in forum Queries
    Replies: 7
    Last Post: 09-21-2011, 09:01 AM
  4. Check to see if record id exists in joined table
    By csoseman in forum Programming
    Replies: 1
    Last Post: 08-18-2011, 01:06 PM
  5. Re: Adding a new record to a joined table
    By Mcdodre in forum Access
    Replies: 4
    Last Post: 06-30-2010, 12:07 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