Remember Me
forgot your password?

Importing External Access Database Tables Using Visual Basic by Nicholas Brown

Sometimes a Microsoft Access database user may find it desirable to automate the process of importing tables from an external Access database file into their current database. Below is a segment of code that provides an example of how to accomplish this.

 

‘*******CODE*******

Dim root As String

Dim srcDB As database

Dim tdf As TableDef

Dim x As Integer

 

Root = “C:”

Set srcDB = OpenDatabase(root)

For Each tdf In srcDB.TableDefs

x = 0

If (tdf.Name = "CULVERT") Then

DoCmd.TransferDatabase acImport, "Microsoft Access", root, acTable, "CULVERT", "CULVERT"

errorCheck = 1

End If

Next tdf

 

‘******************

 

After the variable declarations, the first line of code sets the variable “root” equal to “C:” which is the location of the external database holding the tables we wish to import. The next line sets our database variable equal to the external database. The next lines of code search through the external database to find the table named “CULVERT.” If this table is found, the table is imported using the DoCmd function. The “acImport” variable simply tells the function that we wish to import information from the database. “Microsoft Access” specifies the type of database containing the table. Following that is the folder location (“root”) of the external database. The variable actable specifies that the object we wish to import is a table. The next two strings contain the table name to import and the name to assign to the imported table when it is imported into the current database. It should be noted that if the table named to be imported already exists in the current database, MS Access will automatically rename the table being imported.

 

Once the desired tables have been imported, they can be utilized just like any of the other tables in the database.

 

Nicholas Brown

Nicholas Brown is a recognized authority on the subject of Access Databases. He is the founder of Database Technology Services (DTS). DTS is a leader in custom Access database development. DTS programmers create databases for corporations, small businesses and individuals. Visit www.dts-consultants.com to see all of the services DTS has to offer.

Rate this Article: 0 / 5 stars - 0 vote(s)
Print Email Re-Publish


Article Source: http://www.articlesbase.com/programming-articles/importing-external-access-database-tables-using-visual-basic-by-nicholas-brown-566986.html
Add new Comment



Captcha
0
1. patil (22:11, 02.06.2009)
How to run above program and import all mdb files from folder.Can you please help me on this.I am new to vb and access

  • Latest Programming Articles
  • More from Nicholas Brown

php software development company

By: usha sharma | 08/07/2009
Professional Web Development Company phpmaestro provides custom website development web application development ecommerce website design and development services. Custom web application development services and professional website development at affordable rates from phpmaestro Company. www.phpmaestro.com is a php Application Development Shopping Cart for e-commerce stores. Our shopping cart software gives our client full control over your online shop its products design development prices sh

Hire ASP .Net Developers Hire Dedicated ASP.Net Developers Offshore ASP.Net Programmers

By: Arshad | 08/07/2009
Since the concept of outsourcing changed the economy of many countries it has been very clear that paying Indian development service providers is very much economical than funding an in-house private team. Analysis says that more than 50% of the cost can be saved by inking contracts with Indian IT service providers.

Windbg Minidump Tutorial:Setting up & Reading Minidump Files

By: Jeannie Lee | 07/07/2009
Windgb Minidump tutorial to set up and read minidump files (.dmp). Setting Symbol File Path. Output of Windbg command. windbg.exe -z [file path to minidump file.dmp] -c !analyze -v.

Javascript Validate Name Field

By: Jeannie Lee | 07/07/2009
Simple Javascript tutorial on validating a name field. Checks to see if there is a value in the name field with Javascript after the user submits a form.

Logo Design- The image creator!

By: Jhonny Sharma | 07/07/2009
Brand image is something that many consumers look for while buying a product. Brand image and brand positioning have become important concepts in the corporate world. When image building strategies are talked about, what tops the list is a creative logo design.

Design principles in logo

By: Jhonny Sharma | 07/07/2009
An element of balance is a mandatory aspect of design. A design is considered to be a great design when it incorporates all design aspects in the required proportion. The design principles are vital for any kind of design.

Organization specific software

By: Manish Shrivastava | 07/07/2009
Different businesses have different technological needs depending upon the type of work they are engaged in. Some businesses might require minimum use of software technology where there might be others whose very business might depend upon the optimum use of technology.

Hire .Net Developers: Hire ASP.Net Programmers

By: Arshad | 07/07/2009
Since the concept of outsourcing changed the economy of many countries it has been very clear that paying Indian development service providers is very much economical than funding an in-house private team. Analysis says that more than 50% of the cost can be saved by inking contracts with Indian IT service providers.

Database Design Basics by Nicholas Brown

By: Nicholas Brown | 21/10/2008 | Databases
Tips and tricks on designing and implementing a database that can handle everything you demand.

Product Delivery: Think Like the Customer by Nicholas Brown

By: Nicholas Brown | 15/10/2008 | Customer Service
Tips and tricks on delivering a product or service that meets all of the needs of your client.

Ms Access Databases Don't Have to Look Unprofessional by Nicholas Brown

By: Nicholas Brown | 30/09/2008 | Databases
Tips and tricks to help maximize the usability of your database by improving the user interface.

Using Comments in Your Programming Source Code by Nicholas Brown

By: Nicholas Brown | 30/09/2008 | Programming
Save time and money by adding comments to your source code.

Increasing Small Business Productivity by Nicholas Brown

By: Nicholas Brown | 27/09/2008 | Small Business
Tips and tricks to help maximize business profits by increasing project efficiency and organization.

Pulling Data From Multiple Tables Into a Single Query in Ms Access by Nicholas Brown

By: Nicholas Brown | 17/09/2008 | Databases
A brief how-to on linking multiple tables within a single query. With this tool, users can develop more complex queries, reducing the need for several queries. This will also reduce the size of the database making it more efficient and easier to navigate.

Becoming an Expert Ms Access Database Programmer

By: Nicholas Brown | 11/09/2008 | Programming
Tips and tricks on becoming your own Access database expert. Follow these guidelines and you will be well on your way to becoming a leader in database development.

Submit Your Articles Free: Signup


Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.09, 1)