I'm trying to export an Access table to a CSV file. I'm using this code:
Function ExportAccessToText() As Boolean
Dim AccessConn As New
System.Data.OleDb.OleDbConnection("Provider=Micros oft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")
AccessConn.Open()
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT *
INTO [Text;DATABASE=e:\My
Documents\TextFiles].[Table3.csv] FROM Table_3", AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
End Function
Which gives this error:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred
in system.data.dll
On the line
AccessCommand.ExecuteNonQuery()
Any ideas what is wrong?
What is the file name produced by this syntax:
e:\My Documents\TextFiles].[Table3.csv]
Will it be named: e:\My Documents\TextFiles.Table3.csv
Thanks,
Brett