ACC: How to Import Several dBASE Databases at Once (1.x/2.0)ID: Q88764
|
Moderate: Requires basic macro, coding, and interoperability skills.
This article explains how you can import dBASE databases in a batch
process by using Access Basic.
Many new Microsoft Access users want to import data immediately from the
systems they are currently using. The Import dialog box in Microsoft
Access enables you to import one table at a time, which usually is
sufficient. However, if you have numerous tables to import, or if you want
to import multiple tables regularly, this process enables you to do so
more quickly.
This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools
provided with Microsoft Access. For more information about Access Basic,
please refer to the "Introduction to Programming" manual in Microsoft
Access version 1.x, or the "Building Applications" manual, Chapter 3,
"Introducing Access Basic" in version 2.0.
This process uses an Access Basic procedure and a batch table. The
procedure is designed for importing only dBASE databases, but you can
modified it to accommodate other file formats.
The batch table lists the tables that you want to import. The Access Basic
procedure reads the table and imports each foreign table listed there. To
create the table and the Access Basic procedure, follow these steps:
Field name Type Length
--------------------------------
Source Directory Text 50
Source Database Text 50
Imported Name Text 50
Type of Table Text 50
Source Directory Source Database Imported Name Table Type
--------------------------------------------------------------
C:\DBASE4 EMPLOYEE.DBF Employee Table dBASE IV
D:\DBASE3\DATA ORDERS.DBF Orders Table dBASE III
Sub BatchImport ()
Dim B_DB As Database, B_TBL As Table
Set B_DB = CurrentDB()
Set B_TBL = B_DB.OpenTable("Batch Import")
DoCmd Hourglass True
B_TBL.MoveFirst
Do Until B_TBL.EOF
DoCmd TransferDatabase A_IMPORT, B_TBL![Type of Table], _
B_TBL![Source Directory], A_TABLE, B_TBL![Source Database], _
B_TBL![Imported Name], False
B_TBL.MoveNext
Loop
DoCmd Hourglass False
End Sub
Keywords : kb3rdparty IsmXbase
Version : 1.0 1.1 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: March 10, 1999