Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    5

    Exclamation Unanswered: Generating file path list in a table

    Hello all,

    I am working on creating a simple document database for my company that searches specific folder.

    So I am trying to load the path and filenames from a dir, including all sub dirs, into a table that I can search in a form

    The code that i found returns a runtime error 13, type mismatch.

    Any input would be great.

    Thanks,
    Ryan Nemeth

    CODE
    *****************

    Private Sub Form_Open(Cancel As Integer)

    Dim MyFile As String
    Dim rst As DAO.Recordset
    Dim db As DAO.Database

    Set db = CurrentDb
    Set rst = db.OpenRecordset("select * from [_tmpFileNames]")

    db.Execute ("delete * from [_tmpFileNames]")

    'Returns first file from list of available files
    MyFile = Dir("C:\*.xls")

    'Add it to the temp table
    rst.AddNew
    rst!Filename = MyFile
    rst.Update

    'Call Dir again without arguments to return the next file
    Do While MyFile <> "" '--- do until no more files
    MyFile = Dir '--- Get next entry.
    If MyFile <> "" Then
    rst.AddNew
    rst!Filename = MyFile
    rst.Update
    End If
    Loop
    End Sub

    ***********************
    END CODE

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    What line is highlighted if you debug the code when you get the error?

  3. #3
    Join Date
    Jun 2004
    Posts
    5
    Set db = CurrentDb


    Quote Originally Posted by DCKunkle
    What line is highlighted if you debug the code when you get the error?

Posting Permissions

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