Results 1 to 2 of 2

Thread: CSV Import

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    4

    CSV Import

    Hey guys,
    just having trouble importing a csv file (bank statement) into an existing table in access, the table is inside a tab control, named tblImport subform1,
    this current code i have creates a new table each time and doesn't update, if someone can change the code for me would be appreciated.

    Code:
    Private Sub cmdImport_Click()
       Dim strfilename As String
    
        With Application.FileDialog(msoFileDialogFilePicker)
            .Title = "Select the CSV file to import"
            .AllowMultiSelect = False
            .Filters.Clear
            .Filters.Add "CSV Files", "*.csv", 1
            .Filters.Add "All Files", "*.*", 2
            If .Show = -1 Then
                strfilename = .SelectedItems(1)
                DoCmd.TransferText TransferType:=acImportDelim, _
                TableName:="tbl_import", Filename:=strfilename
            Else
                Exit Sub
            End If
        End With
    End Sub
    Last edited by Siddharth Rout; May 7th, 2013 at 09:09 AM. Reason: Added Code tags

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: CSV Import

    I think you need to create an Import Specification. This http://www.access-programmers.com/cr...cess-2003.aspx shows how to do it.

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