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...![]()
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...![]()
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.
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...
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.
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