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")
db.TableDefs.Delete "Worktable"
CL:
db.Close
DoCmd.CopyObject , "WorkTable", acTable, "Erpts"
Exit Sub
errorhandler:
If Err.Number = 3265 Then GoTo CL
ErrStr = Err.Number & Err.Description & " has occured in: CopyDBtable "
Debug.Print ErrStr
End Sub

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:
CopyDBtable”

Is there any other way to delete and copy the table in a DB?
Thanks,
Sinni.