Delete & Copy Access table thru VB
I have a database named “Erpts.mdb”. In that DB I have a table called “Erpts”.
What I am trying to do is thru VB program copy the table “Erpts” to another
table called “WorkTable” in the same DB. Every time when it runs the program
delete the “WorkTable” and then copy the table “Erpts” as “WorkTable”. I
have the code as below.
Private Sub CopyDBtable()
'copy the table Erpts to a WorkTable,
On Error GoTo errorhandler
Set db = CurrentDb()
Set wrkJet = CreateWorkspace("NewJetWorkspace", "admin", "", dbUseJet)
Set db = wrkJet.OpenDatabase(App.Path & "\Erpts.mdb")
DoCmd.CopyObject , "WorkTable", acTable, "Erpts"
If Err.Number = 3265 Then GoTo CL
ErrStr = Err.Number & Err.Description & " has occured in: CopyDBtable "
So when I run this I am getting the error as
“3078The Microsoft Jet database engine cannot find the input table or query
'WorkTable'. Make sure it exists and that its name is spelled correctly.
occured in CopyDBtable”
If I have the Access database open I am getting the error as
“2486You can't carry out this action at the present time. has occured in:
Is there any other way to delete and copy the table in a DB?