I want to copy all records from one table to another then erase all records in the first table. I got the code below from another post.
My code:Code:Dim db1 As Database Dim db2 As Database Dim strSQL As String Set db1 = OpenDatabase("C:\MyDir\2000-04-13.mdb") Set db2 = OpenDatabase("C:\MyDir\transport.mdb") db2.Execute "DELETE * FROM MyTable", dbFailOnError strSQL = "INSERT INTO MyTable IN 'C:\MyDir\transport.mdb' " _ & "SELECT * FROM MyTable" db1.Execute strSQL, dbFailOnError
I get an error on my SQL = statement. Error 128. Anyone know how to fix it?Code:Dim dbtemp As Database Dim dbtemp1 As Database Set dbtemp = OpenDatabase("" & App.Path & "\report.mdb") Set dbtemp1 = OpenDatabase("" & App.Path & "\report.mdb") SQL = "INSERT INTO [records] IN '" & App.Path & "\report.mdb'"" SELECT * FROM [records]" dbtemp.Execute SQL, dbFailOnError dbtemp1.Execute "DELETE * FROM [reports]", dbFailOnError




Reply With Quote