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

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

iPhone Web Development Company: Helping You Get the Best of Web Applications

By: Arun Kumar | 22/12/2009
One gadget that has stunned the entire pool of gadget freaks through its awe-inspiring features and looks is the exquisite iPhone, a gem of a product from the Apple stable. It’s a device that everyone would like to touch, everyone would love to explore!

Joomla – Best Open Source Content Management System You Can Get

By: ali momin | 21/12/2009
Joomla is an open-source content management system (CMS) used to make a websites. Open-source means all underlying code is offered for free use and modification. So, there may be many applications running in a Joomla-built website, but they are usually free software available to use or modify.

Know the knowledge about photo accessories

By: Henry Miller | 21/12/2009
Lots of photo accessories websites have large ranges of professional photography and photograhic equipments in the world market.

Offshore ASP.NET Application Development

By: Daviodjones035 | 21/12/2009
Semaphore-Software has been offering asp.net application development services significantly. Nowadays the most famous websites make use of Asp.net application development. A strong and talented team is working magnificently

Know more knoeledge about ps2 games

By: Carolynsherwin | 21/12/2009
Consumers should know that ps2 games are also called as PlayStation2 games released on Blu-ray disc in themarket. consumers can visit List of downloadable PlayStation2 games for knowning the list of downloadable PlayStation Network in many countries.

Facebook Applications – Are you promoting your business?

By: facebook guru | 21/12/2009
Facebook is the leading social network with the largest user base in the world. The platform equips a marketer with extensive features which help in increasing brand awareness and in promoting business. One of the most successful and effective method of promoting your business is Facebook Applications.

Web Development Solutions: Expanding the Scope of Online Marketing

By: Arun Kumar | 19/12/2009
The Internet represents a classic example of how fast technology can grow and developed. From a humble beginning, the use of Internet has pervaded into a wide scope of human activities from buying and selling goods and services to providing information and acting as platform for instant communication.

Custom Web Development - The Principle Objective Of The Intranet/extranet Applications

By: Xicom Technologies Ltd. | 18/12/2009
The leading-edge technologies, requirement-based Web as well as Desktop applications ensures a longer shelf-life and your business will get a complete new dimension. They are necessary to be maintained/ supported and produce optimum business value.

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.

Importing External Access Database Tables Using Visual Basic by Nicholas Brown

By: Nicholas Brown | 18/09/2008 | Programming
A brief how-to on importing external database tables using Visual Basic code. This tool can help users to automate their databases, saving time and money.

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.14, 5, w3)