Generating hyperlink from text in Access

DennisJones

Registered User.
Local time
Today, 11:36
Joined
Feb 27, 2007
Messages
36
I have a table with one field set as a hyperlink. I have to generate the hyperlink according to what else is going on in the record, I do this by assembling a text string which I can write to a text field in the same record. I have no problem doing this but when I try to copy that string into the Hyperlink field I get type mismatch. Incidentally if I put two text boxes on a form and bind one to the text and one to the hyperlink field the I can 'cut and paste' it OK so how come I can't do it with Access basic?

Dim stGunlib As String
Dim stGunlib2 As String
stGunlib2 = [Stock number]
stGunlib = "www.shooting.uk.com/Gunlibrary/" + stGunlib2 + ".jpg"
[Link] = stGunlib
[Picture] = stGunlib ([Picture] is a hyperlink field) it goes wrong here


I am using Access 2002

Thanks Dennis
 
Try:
stGunlib = "#http://www.shooting.uk.com/Gunlibrary/" + stGunlib2 + ".jpg#"
 
Text to hyperlink

No that didn't work either. I now get run time error 2220. .....can't open file '#http:.........etc......jpg#'

It's as if it's trying to open the link rather than just store it.
 
Last edited:
Is [Picture] a hyperlink data type field in the table?
 
You are missing the Me object.

Dim stGunlib As String
Dim stGunlib2 As String

stGunlib2 = Me![Stock number]
stGunlib = "#http://www.shooting.uk.com/Gunlibrary/" + stGunlib2 + ".jpg#"
Me![Link] = stGunlib
Me![Picture] = stGunlib
 
You are welcome – good luck on your project.
 

Users who are viewing this thread

Back
Top Bottom