image linking by batch?

J

Jojo

Whew!, I have 45,000+ images in a folder all named by a code (i.e.,
4567.tiff), I have an access table with descriptions for each of the photos.
I need to create a may to many relatioship, which I beleive I can do (since
one description can go to many photos and many descritpions can go to one
photo). From reading the boardsa I know I want to link images, but how do I
link by batch so I odn't have to manually enter in each hypelrink?....I know
just enough to be dangerous I guess because my end result is to have a visual
basic GUI accessing the access tables and displaying the images....sort of a
many-to-many description photo database.

Am I way over my head here?...I think I can handle the visual basic...just
dont know how to get all the file links into access....

If I am over my head...how much am I looking to spend ...ballpark ...for
someone to do this real fast?...I am a dental school student trying to get a
patient history presetnation done that will blow the professors socks off!

Thanks in advance!
 
B

Brendan Reynolds

This assumes the images are in the same folder as the MDB. And I used JPG
files for testing, because I don't have many TIF files. I'll mark the lines
you need to change with comments.

Public Sub TestSub()

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strInput As String

Set db = CurrentDb

'Change this to reflect your table and field names ...
Set rst = db.OpenRecordset("SELECT TestUrl FROM tblTest", dbOpenDynaset,
dbAppendOnly)

'Change this to reflect your folder and extension.
strInput = Dir(CurrentProject.Path & "\*.jpg")

Do Until strInput = vbNullString
With rst
.AddNew

'Change this to reflect your folder.
.Fields("TestUrl") = "#file://" & CurrentProject.Path & "\" &
strInput & "#"

.Update
End With
strInput = Dir()
Loop
rst.Close
MsgBox "Finished"

End Sub

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
J

Jojo

Brendan, I really apprecite your quick response. This may reflect my
ignorance...but I put the code and make my specific changes in a form within
acess...or just create a short VB program with it?

Regards
 
B

Brendan Reynolds

If you paste the code into a standard module, you can call it by name either
from the Click event of a command button on a form ...

Private Sub Command0_Click()

TestSub

End Sub

.... or simply by typing its name in the Immediate window and pressing Enter.

It sounds like this will be a once-off operation, so I'd just run it from
the Immediate window. No point messing about with forms and command buttons
if you're only going to use it once.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

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