Hi All,
I have a control datbase , and I would like to copy/paste the table using the VBA code.
Meaniang
copy the X table from "CoreDB"(SourceDB) into "TargetDB".
I'm trying to used the following VBA code but getting some errors
Option Compare Database
Option Explicit
Sub CopyTbl()
Dim conn As ADODB.Connection
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim WSP As DAO.Workspace
Dim rs As ADODB.Recordset
'Set conn = Server.CreateObject("ADODB.Connection")
Set dbs = WSP.OpenDatabase("N:\InfoCom\Farhan\Test_DB\Test1.mdb")
End Sub
" Run-time error 91
Object variable or With block variable not set.
When I google it says I haven't attached the libraries under Reference menu or may not use thw "with2 and "end". don't konw which library or how to use
Yesterday , I was trying to use the CopyObject as mentioned below but didn't get the success.
DoCmd.CopyObject "N:\InfoCom\Farhan\Test_DB\test1.mdb", "emp", acTable, "tablename"
I would appreciate if you could guide me
Many thanks in advance
Farhan
I have a control datbase , and I would like to copy/paste the table using the VBA code.
Meaniang
copy the X table from "CoreDB"(SourceDB) into "TargetDB".
I'm trying to used the following VBA code but getting some errors
Option Compare Database
Option Explicit
Sub CopyTbl()
Dim conn As ADODB.Connection
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim WSP As DAO.Workspace
Dim rs As ADODB.Recordset
'Set conn = Server.CreateObject("ADODB.Connection")
Set dbs = WSP.OpenDatabase("N:\InfoCom\Farhan\Test_DB\Test1.mdb")
End Sub
" Run-time error 91
Object variable or With block variable not set.
When I google it says I haven't attached the libraries under Reference menu or may not use thw "with2 and "end". don't konw which library or how to use
Yesterday , I was trying to use the CopyObject as mentioned below but didn't get the success.
DoCmd.CopyObject "N:\InfoCom\Farhan\Test_DB\test1.mdb", "emp", acTable, "tablename"
I would appreciate if you could guide me
Many thanks in advance
Farhan