Results 1 to 2 of 2
  1. #1
    mcboe is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    1

    Group linked to one record and copy to another

    Hi there,



    First post so please excuse me if I haven't added this to the right place or if this has already been discussed. As you all know, individual scenarios present their own unique challenges.

    For me, I have entities that have associated "People Groups" (Ex.: Officers). In each of those groups, I have the individual people that are linked to that group.

    What I'm hoping to achieve is a way to copy one group of people (Ex.: Officers) from one Entity (Ex.: ABC) to another entity (Ex.: XYZ). To do so, I've created a pop-up for my users to select the entity and then the group (Ex.: ABC and then Officers). They would access this through the new entity's form view (Ex.: XYZ). Once they click 'Save' (or otherwise), the group of Officers from ABC would be copied to XYZ as Officers (highlighted in yellow).

    Now, in the preliminary research I've done, it seems like 'append query' is the route to go. However, I do not have the know-how to figure out how to create a new "People Group" with the same information as the old "People Group" while also changing the Entity associated with the group.

    Below you'll find the relationships for the tables used and the examples again in the blue boxes.

    I appreciate any help that anyone can provide!

    All the best,

    MB
    Click image for larger version. 

Name:	Snapshot_Entities.JPG 
Views:	4 
Size:	43.0 KB 
ID:	20679

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Why is Entity field in two tables?

    Why is the contacts foreign key field in tbl_GroupContacts called FirstName? Better would be ContactIDfk.

    I would run an SQL statement in VBA, like:

    CurrentDb.Execute "INSERT INTO tbl_GroupContacts(ContactIDfk, Committee) SELECT ContactIDfk, {XYZ committee ID here} AS Committee FROM tbl_GroupContacts INNER JOIN tbl_Group_People ON tbl_Group_People.ID = tbl_GroupContacts.Committee WHERE Committee = {ABC committee ID here} AND tbl_Group_People.Entity='Officers'"

    The {} characters would be removed in actual statement. If using variables to hold inputs for committee and entity, concatenate to build the SQL statement.
    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.

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

Similar Threads

  1. How to Create local copy of linked Table
    By behnam in forum Programming
    Replies: 3
    Last Post: 11-20-2014, 05:49 PM
  2. SQL to copy Emails from linked inbox
    By WhiskyLima in forum Access
    Replies: 9
    Last Post: 08-01-2014, 06:50 AM
  3. Replies: 5
    Last Post: 11-01-2013, 10:34 AM
  4. Replies: 2
    Last Post: 02-19-2013, 07:47 AM
  5. Linked tables and copy
    By TimG in forum Access
    Replies: 2
    Last Post: 10-08-2009, 07:54 AM

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