Results 1 to 4 of 4
  1. #1
    skidawgs is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    26

    Question Inserting Into Multiple Tables - (Unbound?)

    Hi,



    Is using an unbound form the only way to insert into 2 tables at the "same" time?

    I am creating a "Add Candidate" form that my user can add a candidate to a position. The table design includes a CANDIDATE, CANDIDATE_POSITION, and POSITION (with a m-m relationship). The main form is based on the POSITION table, so when the user selects a 'Add Candidate' Button, the pop-up form would allow them to insert necessary data. Except, I would like them to insert this data into both tables without needing to add a candidate first then associating that candidate with the position. Instead, I would like to (if possible) populate the CANDIDATE_POSITION.Position_ID with an argument passed from the mainform, then insert into both other tables via a button click.

    Is the best way to do this via an unbound form? Or are there any better alternatives?
    P.S. - I'm familiar with SQL so would insert into CANDIDATE before inserting into CANDIDATE_POSITION.

    Thanks!
    Skid

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Use bound forms.

    Main form bound to Position, subform bound to Candidate_Position with a combobox to select candidate. Master/Child Links properties of subform container will automatically save PositionID into Candidate_Position.

    Options to add new candidate 'on-the-fly' during data entry:

    1. with combobox NotInList event

    2.
    open candidate input form with combobox ListItemsEditForm property (I've never tested this)

    Review

    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
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Be aware that "POSITION" is a reserved word and shouldn't be used for object names....

    POSITION: JET reserved (kb248738);ODBC (kb125948);ANSI-92 Reserved (kb287417) (http://allenbrowne.com/AppIssueBadWord.html#P)

  4. #4
    skidawgs is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    26
    Thank you for the prompt replies! I will go with your method, June7. I suppose there will just be a couple more clicks which really isn't the end of the world and it is much better than the alternative of an unbound form.

    Also, thanks for the insight about using the reserved word POSITION. I hadn't realized it was reserved until now.

    Thanks,
    Skid

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

Similar Threads

  1. Replies: 7
    Last Post: 06-02-2017, 03:59 PM
  2. unbound form to update multiple tables
    By osupratt in forum Forms
    Replies: 3
    Last Post: 09-22-2016, 02:43 PM
  3. Inserting records in multiple tables
    By Nikos in forum Database Design
    Replies: 8
    Last Post: 02-17-2012, 02:35 PM
  4. Inserting records into tables with autonumber
    By LAazsx in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2010, 11:55 PM
  5. Inserting Multiple values
    By rajath in forum Access
    Replies: 1
    Last Post: 05-14-2010, 04:17 AM

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