When I used that it only puts the hyperlink address in
the value of the field. The value of the field and the
hyperlink address are not the same value. The user inputs
a file name and when he clicks add record it wil put the
filename as the value and attach a hyperlink to that
field. Is this possible?
Oops! That wasn't the solution at all. Sorry. <grunt>
Look up "HyperlinkPart Method" in Access VBA Help. The "value" assigned to a
hyperlink field can contain a string to set the various properties of the
hyperlink and using the "HyperlinkPart Method", you can retrieve various parts
of the hyperlink in and modify the string that sets a new value. The example
below sets both the Display Text and the Hyperlink Address for the field
"HyperAddress":
'************EXAMPLE START
Dim strDelimiter As String
strDelimiter = "#"
Me.HyperAddress = "The Access Web" & strDelimiter _
& "
http://www.mvps.org/access/" & strDelimiter
'************EXAMPLE END
To retrieve the "Address" part, you can use
strAddress = Application.HyperlinkPart(Me.HyperAddress,acAddress)
You can then edit the "Display Text" property for that hyperlink by using:
Me.HyperAddress = "The Wonderful Access Web" _
& strDelimiter & strAddress _
& strDelimiter
You can use the same technique to change the "Address" portion while maintaining
the same "Display Text".