Results 1 to 2 of 2
  1. #1
    tintindeluxe is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    1

    Copying data from one table to new records in another table

    Hi,


    I'm looking to copy records from one table into another using a command button.

    I have a form that displays data from a table called "Training Records". The table has fields named "StaffID", "Training Session" and "Attended", which is a Yes/No field.

    I'm looking to create a command button that would open up a new form showing a table named "Non-Attendance" and copy the "Staff ID" into a new record for each of the Training Records that were not checked as "Attended" for the training session shown in the previous form.

    Sorry if my question was a bit long winded. I'm very new to access and still learning so I may need things explained in layman’s’ terms please!!

    Cheers
    Kylie

  2. #2
    khalid's Avatar
    khalid is offline MS-Access Developer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2010
    Location
    Kuwait
    Posts
    244
    Welcome to the forum,

    You can copy the unchecked/attened records to table "Non-Attandence" by putting the VBA Code on Click Event of the command button:

    Code:
     
    Docmd.RunSQL "INSERT INTO [Non-Attandence] SELECT FROM [Training Records] WHERE [Training Records].[Attended] = False"

    HTH.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-23-2011, 10:39 AM
  2. Replies: 6
    Last Post: 03-22-2011, 08:22 PM
  3. Replies: 1
    Last Post: 12-28-2010, 11:24 AM
  4. Replies: 1
    Last Post: 03-08-2010, 02:32 AM
  5. Replies: 0
    Last Post: 02-24-2010, 12:56 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