filename importing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to import filenames (xxxx.jpg) from a directory, to
one of my tables. The filename is a primary key. The new
filename would be its own line item with 2 other fields
attached to it. I've search this newsgroup but have found
nothing. I hope one of you godlike MVP's can help me with
this.

Gym Lyle
 
Something like this can get you started:


Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strFile As String

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("TableName", dbOpenDynaset, dbAppendOnly)

strFile = Dir("C:\FolderName\*.jpg")
Do While strFile <> ""
rst.AddNew
rst!PrimaryKeyFieldName = strFile
rst.Update
strFile = Dir()
Loop

rst.Close
Set rst = Nothing
dbs.Close
Set dbs = Nothing
 
Back
Top