Dim connect As String
        connect = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\segdata.accdb"
        Dim conn As New OleDbConnection(connect)

        Dim sr As System.IO.StreamReader
        Dim entirefile As String


        sr = File.OpenText(Application.StartupPath & "\SEG1.txt")
        entirefile = sr.ReadToEnd() ' Read the whole file 

        Dim OriginalValue As String
        OriginalValue = vbTab
        Dim ReplaceValue As String
        ReplaceValue = ","
        entirefile = entirefile.Replace(OriginalValue, ReplaceValue)
        sr.Close()
        'write 
        Dim sw As IO.StreamWriter = File.CreateText(Application.StartupPath & "\SEG1.txt")
        sw.Write(entirefile)
        sw.Close()


        Dim query As String = "INSERT INTO  SEGDATA (School, Campus, AdminNo, ModuleCode, ModuleGrp) " & _
       "SELECT F1 as School, F2 as Campus, F3 as AdminNo, F4 as ModuleCode, F5 as ModuleGrp FROM [Text;DATABASE=" & System.IO.Path.GetDirectoryName(Me.OpenFileDialog1.FileName) & ";HDR=NO].[" & Me.OpenFileDialog1.SafeFileName & "]"
        Dim cmd As OleDbCommand = New OleDbCommand(query, conn)


        conn.Open()
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        conn.Close()

i have these codes to actually replace the tabs delimiter to commas in my text file and insert them into access database. but im receiving this error: "No value given for one or more parameters" Anyone tell me whats wrong?
if i remove the part for the replacement of delimiters, and select a pure CSV file, it works fine.

This might be of some assistance.
A tab consists of a certain number of blank spaces, if one field just happens to have that number of spaces without being a tab that might cause the problem you're having.

You may have to include some double cheching to compare the text of each field using both the original and the new csv.
Also, check to see if one or more of the fields contain a single-quote.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.