Results 1 to 2 of 2
  1. #1
    Praveenevg is offline Novice
    Windows 8 Access 2007
    Join Date
    Aug 2014
    Posts
    18

    VBA - Insert a record from one table to other

    Hello,
    Fairly new to VBA coding.

    In my VBA code, i am trying to move some table records from table1 to table2. Both table1 and table2 has exact structures.

    In the INSERT statement for table2, what is the easy way to insert a record from table1? I am trying to avoid having to specify each field name in the INSERT statement. Because, i have 100 fields in table.


    Is there a way to INSERT a particular record from table1 to table2 without having to specify field names in the INSERT statement like in below example?

    INSERT INTO Employees " _


    & "(FirstName,LastName, Title) VALUES " _
    & "('Harry', 'Washington', 'Trainee');"

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Why do you need to do this?

    This syntax works for me:
    INSERT INTO [tablename] SELECT * FROM [tablename] WHERE ID=someID
    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. Insert a new record in a particular position in a table?
    By accessorizer in forum Programming
    Replies: 7
    Last Post: 04-07-2012, 04:21 PM
  2. Replies: 7
    Last Post: 01-02-2012, 06:19 PM
  3. Insert record from table into different table
    By tpcervelo in forum Forms
    Replies: 3
    Last Post: 01-25-2011, 02:41 PM
  4. Replies: 7
    Last Post: 12-15-2010, 09:46 AM
  5. Insert Record checks table
    By pfarnell in forum Forms
    Replies: 13
    Last Post: 09-05-2010, 10:47 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