Making table from files

G

Guest

I'd like to make a table from all the files in a folder... I want these
records to be imported easily ... I don't want to be forced to type each and
every filename in as a record.
 
T

tina

here's the code i use in one of my dbs:

Public Function isFiles() As String

' On Error Resume Next

Dim str As String
str = Dir("put the folder path here" & "*.*")

Do Until str = ""
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO TableName ( FieldName ) " _
& "SELECT '" & str & "'", False
DoCmd.SetWarnings True
str = Dir
Loop

End Function

hth
 
T

tina

i should note that the code i posted does not *create* the table, it merely
populates it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top