***** InfoCopter.com *****

MS Access Automated Data Import

See also Forum


Questions would match this topic:

  1. code to import relationships or other external data
  2. import data from Excel or flat file in batch mode into a MS Access database


Help! Assume this must be a common task! We want to import new data from Excel or flat file input in batch mode into a MS Access database. Have anybody some code available?

Thanks!! --Reto


something like that (doesn't work yet ;-)

Option Compare Database
Option Explicit

Dim nWindEx As Database, tDef As TableDef
Dim dataSource As String

dataSource = "Excel 97;DATABASE=C:\temp\import.xls"
    
Set nWindEx = Workspaces(0).OpenDatabase(Application.Path _
    & "\NWINDEX.MDB")
    
Set tDef = nWindEx.CreateTableDef("Product")
tDef.Connect = dataSource
tDef.SourceTableName = "Product"
nWindEx.TableDefs.Append tDef

nWindEx.Close

What I found out till now
  1. MS Access Help
  2. Sample Code from Microsoft





©1998-2002 InfoCopter