supersal666
Member
Hi everyone, I have an access table and I need to be able to update the table with data from a | delimeted text file.
The textfile is like below:
At the moment I have some vb.net code which puts the data into a table (creates a new table) I actually need it to update the table (rather than create it) and seperate the values by the | character and put them into
the different fields.
Has anyone got any sample code of how to add the data from the textfile using | as delimeters to put each value into the table into different fields?
Thanks
Sally
The textfile is like below:
Card Number|Title|Forename|Surname|Address Line 1|Address Line 2|Address Line 3|Address Line 4|Address Line 5|PostCode|NOB|BarCode
123456|Mr|Mo|EYEOYIBO|43 Some Road|||Any Town|Kent|AB1 2CD|Plumber|0000200063571
654321|Mr|Terrence|Denman|29 Silly Avenue|||BlackTown|East Sussex|T22 7BG|Tiling / Kitchen & Bathroom Installation|0000200063623
At the moment I have some vb.net code which puts the data into a table (creates a new table) I actually need it to update the table (rather than create it) and seperate the values by the | character and put them into
the different fields.
VB.NET:
Module Module1
Sub Main()
'Function ImportTextToAccess()
Dim myConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=mydatabase.mdb;")
myConn.Open()
Dim myCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Table3] FROM[Text;DATABASE=Text;DATABASE=C:\].[textfile.txt]", myConn)
myCommand.ExecuteNonQuery()
myConn.Close()
End Sub
End Module
Thanks
Sally
Last edited by a moderator: