Results 1 to 2 of 2

Thread: Text file to Access 97 database

  1. #1

    Thread Starter
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    here is how you connect to a CSV text file:
    Code:
    'Uses ADO 2.1/5
    
        Dim cn As ADODB.Connection
        Dim rs As Recordset
        
        Set cn = New Connection
        Set rs = New Recordset
        
        'open connection to folder that contains the CSV file
        cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\;Extended Properties=Text;"
        
        'open the file
        rs.Open "select * from test.csv", cn
        
        'we have data
        MsgBox rs.Fields(1).Value
    Just loop through your recordset and insert the values into your MS Access table (you'll have to create a separate conneciton, of course)

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Tom's method will certainly work but you might want to take a look at Access's "TransferSpreadsheet Method" (if you have access installed search in help for the item in quotes).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width