Importing several files with path according to field

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kv29
    New Member
    • Apr 2008
    • 7

    Importing several files with path according to field

    Hello, I would really appreciate some help, Im quite a newbie with VB in access.

    What Im trying to do is to import several XLS files that are distributed in various folders in C:\

    I`ve made a table in wich one of the fields contains the PATH to each of those files, so what I need should be simple a simple task to do: a routine that iterate the full recordset reading all those paths and automatically import the files contained in those folders into a new table.

    Any ideas will be most welcomed!
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    I'm sorry I haven't learned about importing yet, but I can give you the code to iterate through the recordset if you don't have it already. Maybe someone can fill in the import stuff.

    Code:
    Dim db as Database
    Dim records as DAO.RecordSet
    
        Set db = CurrentDb()
        Set records = db.OpenRecordset("myTable")
    
        while not records.eof
            'import based on records!fieldName
            records.MoveNext
        wend
    
        records.close
        set records = Nothing
        db.close
        set db = Nothing

    Comment

    Working...