Access table to tab delimited text file?

  • Thread starter Thread starter Guest
  • Start date Start date
¤ Using VB.NET how can I convert access table to tab delimited text file?

The following should work:

Function ExportAccessToText() As Boolean

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

'New table
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO
[Text;HDR=No;DATABASE=e:\My Documents\TextFiles].[td.txt] FROM Table_3", AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()

End Function

You will need a schema.ini file if a custom delimiter (tab) is required. The contents will look like
the following:

[td.txt]
ColNameHeader=False
Format=TabDelimited
CharacterSet=ANSI


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top