How to import text file to access database? 
Author Message
 How to import text file to access database?


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





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


Tue, 29 Feb 2000 03:00:00 GMT  
 How to import text file to access database?


I believe your may need to ad the file extention? change -
MyTableDef.SourceTableName = "LOG"


MyTableDef.SourceTableName = "LOG.CSV"

         Alan Davis, Southampton, England

Wed, 08 Mar 2000 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. how to import text file into access database

2. Importing text files to a second database w/in Access

3. Importing text file into Access database via VB5

4. HOw to import a text file with fixed column in an access database

5. importing text of Outlook attachment to Access database

6. importing Text to access database

7. Import Text files to the database?

8. Importing Text File into DataBase Slow !

9. Importing Text File into DataBase Slow !

10. HELP - Importing Text file into database

11. Import Text File in database with ISAM driver

12. Import a text file to Database


Powered by phpBB® Forum Software