Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Importing Txt Files (Access XP)

    I'm using the following code to import all the files in a specific directory. Some of the files have nothing in it 0 kb. How do I change the code to ignore those.

    Function ImportDetail()
    On Error GoTo Macro1_Err

    Dim FileName As String
    Dim FolderName As String

    FolderName = "c:testinvoice Detail"

    FileName = Dir(FolderName & "*.txt")
    While FileName <> ""
    DoCmd.TransferText acImportDelim, "DetailImport", "InvoiceDetail", FolderName & "" & FileName
    FileName = Dir()

    Wend

    Macro1_Exit:
    Exit Function

    Macro1_Err:
    MsgBox Error$
    Resume Macro1_Exit

    End Function


    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Importing Txt Files (Access XP)

    Why ignore them, you won't import anything anyway.
    Do you get an error when you import one of these?

  3. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Txt Files (Access XP)

    No

    It seems that Access automaticly ignore's the empty files

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •