Retrieving file names from a directory (1 Viewer)

jfi

Registered User.
Local time
Today, 17:06
Joined
Jan 28, 2000
Messages
22
Is there any good way of retrieving the file names from a directory? Each file name would be inserted into a record in a text field.

Thanks in advance

-josh
 

jfi

Registered User.
Local time
Today, 17:06
Joined
Jan 28, 2000
Messages
22
alright, let me be very specific about what I'm trying to figure out how to do.

There will be two directories, 'Pics' and 'NewPics.' These will store pictures brought in from a digital camera. NewPics will house the pictures just brought in and not entered into the database yet and Pics will keep everything that's accounted for in the database. Each file name is unique, composed of the date and time the picture was taken, along with a 2 digit number to separate out any pictures that happened to be taken in the same minute (this is all done automatically by a different program called Digipics).

OK, so here's what I need to do. There are going to be thousands of these pictures, so I don't have the time to sit down each day and manually enter the file names into records. I'd like Access to get the list of file names in NewPics, add each file name to a new record in the database, and finally copy all the files in NewPics to Pics.

I really hope someone will be able to help, as the number of pictures is really starting to pile up...


-josh
 

jfi

Registered User.
Local time
Today, 17:06
Joined
Jan 28, 2000
Messages
22
OK I figured it out.

I put a button on my form with this behind it:

Private Sub getnames_Click()
Dim myfolder As String
Dim myext As String
Dim mypath As String
Dim myfile As String

myext = Me![extension]
myfolder = Me![path]
mypath = myfolder & "\" & "*." & myext
myfile = Dir(mypath, vbNormal)
Do While Len(myfile) > 0
DoCmd.GoToRecord , , acNewRec
Me![filename] = myfile
myfile = Dir
Loop

End Sub

I didn't know about the Dir command. It's pretty darn useful. Well, I hope someone can use this information.
 

Users who are viewing this thread

Top Bottom