Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open picture named in field via hyperlink

Status
Not open for further replies.

BakerUSMC

Technical User
May 24, 2003
96
US
Hello to all,

I have a database that I want the users to enter the picture name (i.e. pic1.jpg) into a field. Once the name is entered, I was Access2K to open that picture in Windows Explorer window once the field is clicked.

I have the field type as 'Hyperlink' but Access adds http:\\ before the file name. I tried to replace that using:

Private Sub Picture_AfterUpdate()

txtPicture = Replace(txtPicture, "# "#C:\Documents and Settings\DBA\My Documents\")
End Sub

but it doesn't work. Does anyone know how to fix this?

Also... How can I have the location to be changed depending on the network the db is on. Meaning, I am sending this db to our field offices where they will input all the info and have pictures saved on their server. Once they send the info back to me at HQ, I will need to change the location path back to my server.

Is there an easy way where the field offices can input the location path specific to their network without using VBA?

Thanks so much for your help!!!!!!!!!!!!!!!!!!!!!

BakerUSMC
 
How would the outer offices enter the network locations? like \\blah blah and you just add to the file name?

Either way, assume you have a string "C:\Mypic.JPG", try

FollowHyperlink "C:\MyPic.JPG" will open it.

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.

 
Blorf,

Thanks for the reply. But not exactly what I was looking for. Let me try this...

Field = txt Picture

User will enter 039.jpg in the field txtpicture

When the click on that field, it will hyperlink them to open that picture. But the hyperlink field automatically adds http:\\ to the field so when you click, you get http:\\039.jpg. I want Access to replace http:\\ with C:\Documents and Settings\DBA\My Documents\ So that when they click that field, they activate the hyperlink for C:\Documents and Settings\DBA\My Documents\039.jpg

Hope that explains it better for you. Thanks!!

BakerUSMC
 
Take a look at the HyperlinkPart method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV's suggestion is good. But if your goal is just to open a picture, why use a hyperlink field at all? if you are supplying a text string that has your file path, just calling followhyperlink will open it.

X = "C:\039.JPG"
Followhyperlink X

ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top