Results 1 to 5 of 5
  1. #1
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51

    Copy all data from table1 to table2 in database2


    Hi I need help with vba to copy all data from table1 in database1 to table2 in database2. both the tables has same fields...with attachement field too.

    Thanks alot in advance for helping...

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    go to your database 2, import the table from database 1, you don't have to copy anything let the database engine do it for you.

  3. #3
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51
    rpeare, thanks for helping...
    I want to be able to do this bacause one is front end and the other is the main database....

    And i can just write simple codes but it wont allow me to transfer the attachment field...i just dont know wht to do...

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    You are sending mixed signals. You said you wanted to copy an entire table from one database to another, which I told you how to do, you do not have to name the table the same thing, just import it with a new name.

    Your second message you are talking about a front end and back end. By definition a back end is a database that just has tables and no other structure. A front end contains only linked tables along with forms, reports, queries etc. but you are talking about transferring a single field which I don't understand. If it's truly a front end/back end there should be no need to copy anything at all, let alone a single field.

  5. #5
    ped's Avatar
    ped is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    51

    runtime error 64224

    Thanks again and apologies if i confusd you...
    'm expirimenting on whatever is possible...
    my main concern here is that the field with attachment wont get transfered to different table....'m trying to get to do that.....

    If anyone could help me out with it then i'd really do appriciate...



    Thanks again


    Code:
    Dim rst As DAO.Recordset
    Dim rst1 As DAO.Recordset
    Dim rsPictures As Recordset
    Set rst = CurrentDb.OpenRecordset("Table2i", dbOpenDynaset)
    Set rst1 = CurrentDb.OpenRecordset("Table2", dbOpenDynaset)
    While Not rst1.EOF
    Set rsPictures = rst1.Fields("Attac").Value
    
    With rst
    rst.AddNew
        rst!qt1 = rst1!qt1
        rst!Q2 = rst1!Q2
        rst!Attac = rst1!Attac
    rst.Update
    rst1.MoveNext
    End With
    Wend
    rst.Close
    rst1.Close
    Set rst = Nothing
    Set rst1 = Nothing

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

Similar Threads

  1. Copy data from one form to another
    By rcrobman in forum Programming
    Replies: 12
    Last Post: 05-24-2011, 01:25 PM
  2. Copy data from Tables in VBA
    By MattyT in forum Programming
    Replies: 4
    Last Post: 12-24-2010, 10:07 AM
  3. Replies: 5
    Last Post: 08-20-2010, 06:40 AM
  4. Use Table1 to update Table2? Urg Help needed
    By munkifisht in forum Queries
    Replies: 1
    Last Post: 07-24-2009, 08:00 AM
  5. COPY DATA and TRIM
    By Ed H in forum Access
    Replies: 1
    Last Post: 01-01-2009, 07:01 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