Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DOCMD-TRANSFERDATABASE-VB EQUIVALENT

Posted on 1999-07-03
2
Medium Priority
?
471 Views
Last Modified: 2013-12-25
I have several tables in a database called
data1.mdb
I'am exporting these tables to another database called
data2.mdb
I'am using the docmd.transferdatabase method
I plan soon to put the program In VB5.
What is the equivalent code to use for VB5 on this method.
Let's say i have two tables called
Table1
Table2
They need to be exported to data2.mdb
fordraiders
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
simonbennett earned 200 total points
ID: 1506125
OK,
You could use ole...

 Dim accObj As New Access.Application
 Set accObj = New Access.Application
   
 accObj.OpenCurrentDatabase ("c:\mydb.mdb")
 accObj.DoCmd.TransferDatabase acExport, "Microsoft Access", "c:\myotherdb.mdb", acTable, "SourceTable", "DestinationTable,false"
   DoEvents
   accObj.CloseCurrentDatabase
   Set accObj = Nothing

This keeps it similar to your original code

or a more elegant way....

OPen up a dao workspace, then open 2 database objects. Then you can read a dynaset from the source to create a tabledef in the destination.

HTH
0
 
LVL 6

Expert Comment

by:simonbennett
ID: 1506126
Oh, for the access.application code you need to include a reference to the 'microsoft access 8.0 object library'.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question