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?
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL