
How to import text file to access database?
Hello!
I have problem that I have over 10Mb text files that I have to import to
a database. Text file is delimited with tabs.
I have tried to read the file char by char but it takes too long time to
do that way.
I have read that it's possible to do it like in Access with import.
I have tried it with following code but it doesn't work!! why?
or is there any other way to do this?
***********************************************************
Dim CurrentDatabase As Database
Dim MyTableDef As TableDef
DBEngine.IniPath = "H:\vb\project\log.ini"
'Open Microsoft Jet database named PSA.MDB.
Set CurrentDatabase = Workspaces(0).OpenDatabase("C:\PSA.MDB")
'Create TableDef.
Set MyTableDef = CurrentDatabase.CreateTableDef("LOG")
'Set connection information.
MyTableDef.Connect = "Text;Database=H:\VB\PROJECT\"
MyTableDef.SourceTableName = "LOG"
'Append TableDef to create link.
CurrentDatabase.TableDefs.Append MyTableDef
***********************************************************
***********************************************************
LOG.INI
[TEXT ISAM]
Extensions=txt
ColNamedHeader=False
Format=TabDelimited
MaxScanRows=0
CharacterSet=OEM
***********************************************************
the code gives an error message:
Run-time error '3011':
Couldn't find object 'LOG'
P L E A S E !!!!!
If someone has any idea what to do, tell me!
BR Petri
http://www.*-*-*.com/