Importing image files from a dirctory

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

I am trying to import 300 jpgs from a directory into a access database.
Associate names with each graphic and move to another directory and use a
hypertext field to link to the location of the picture.
Can anyone point me in the right direction to do this using VB. or point me
to a good tutorial page explaining how to do this.
thanks!
 
Hi Bill,

It sounds as if you're wisely intending to leave the images in their own
files and just store hyperlinks in the database.

I'd probably do it something like this:

1) Using Windows Explorer, move the files into the folder structure I
want.

2) At a command prompt, use a command like
DIR /B /S "D:\Folder\Subfolder\*.jpg" > D:\folder\jpglist.txt
to create a textfile containing a list of the filespecs (path and name).

3) Create my Access table containing a hyperlink field, a text field for
the associated names, an autonumber primary key field, and whatever else
is needed.

4) Import the filespecs from the textfile into the hyperlink field.

5) Add the names and other data.

I am trying to import 300 jpgs from a directory into a access database.
Associate names with each graphic and move to another directory and use a
hypertext field to link to the location of the picture.
Can anyone point me in the right direction to do this using VB. or point me
to a good tutorial page explaining how to do this.
thanks!

John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
You can use fileCopy to copy the files
Use dir to accumulate the fileNames (into your links table
or where ever)
add additional field for displayName

sample use of dir

Function DirToDelimString(strPathName, strDelim) As String
Dim strRet As String
Dim strFile As String
strFile = Dir(strPathName)
strRet = strFile
Do Until strFile = ""
strFile = Dir()
If Len(strFile) > 0 Then
strRet = strRet & strDelim & strFile
End If
Loop
DirToDelimString = strRet
End Function
 
Back
Top