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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify hyperlink address using expressions????

Status
Not open for further replies.

jwruble

Programmer
May 29, 2002
16
US
I would like to be able to have a hyperlink that could jump to a filename specific to individuals stored in the database. For instance, there are scanned images on the network that are named according the the client ID number (for example, 1027picture.jpg or 2746application.jpg). Is there anyway for me to create a single hyperlink on the frontend that could build its address from the selected ID#. I'm hoping to avoid manually adding a list of thousands of hyperlinks to the individual files.

I tried defining the address as [ID]&"picture.jpg" but had no luck.

Does anybody have ANY info on this sort of thing?

 
jw: You can write a few vba lines to accomplish this. Note that your image names are not consitent but do have Contact ID at their beginning, so you can take advantage of that.

You need to create a button on a Form which reads the Contact ID, constructs the hyperlink, and then launches it. For example, in your first case above, the resulting code you'll need for your button would be:

On_Click of your button

Mybutton.HyperLinkAddress = "c:\Myfolder\MyContact\3456picture.jpg"

...that should work; and of course there are other approaches...so, trick is to create you hyperlink address string using info on the form.

...the string would have been easier to create if all the pics were named, e.g., "8765.jpg" and then all you would need is:

Mybutton.hyperlinkaddress = "c:\MyPics\Mycontact\" _
& Forms![MyForm]![ContactID] & ".jpg"

..but, since you have a variable string on the end of the pic name, you'll have to integrate the "Like" expression in there. This is a good question jw; unfortunetly I am no expert in the criteria area, getting all the " and "'" and ""*"" etc organized. Hopefully one of Tek-Tips gurus will stop by and provide that.

However, lets stay on this because this is an excellent example of parsing together a string using the Like operator and concatenation and will benefit others when we get arrive at a "solution."





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top