Making table from files

D

DrewBe

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.
 
Top