Inserting text from module as a hyperlink

RichardP1978

Registered User.
Local time
Today, 07:30
Joined
Nov 14, 2006
Messages
89
I am using the current code to browse for a filename, which gets inserted in to the relevant text box on a form.

Private Sub Command8_Click()

Dim strFilter As String
Dim strInputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Acrobat Files (*.pdf)", "*.pdf")

'strFilter = ahtAddFilterItem(strFilter, "JPEG Files (*.jpg, *.jpeg)", "*.jpg;*.jpeg")
'strFilter = ahtAddFilterItem(strFilter, "bmp Files (*.bmp)", "*.bmp")
'strFilter = ahtAddFilterItem(strFilter, "all Files (*.*)", "*.*")

strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:="Choose a file...", _
Flags:=ahtOFN_HIDEREADONLY)

If Len(strInputFileName) > 0 Then
DocumentLink = strInputFileName
' Do something with the selected file
Else
'No file chosen, or user canceled
End If

End Sub

The problem is, the text that goes in the text box, does not work as a link. I get the finger cursor when I hover over it and it appears to format it correctly, (blue and underlined as per field type), but when I click on it, it does not do anything at all.

File names that I have manually done myself work ok.
 
A hyperlink in access is stored with max 4 parts (TextDisplayed#adress#subadress#screeninfo) to link the files you need to store the first two so you set the value to:
filepath & "#" & filepath
This will display the full path in the field and contains the hyperlink.
 
PeterF said:
A hyperlink in access is stored with max 4 parts (TextDisplayed#adress#subadress#screeninfo) to link the files you need to store the first two so you set the value to:
filepath & "#" & filepath
This will display the full path in the field and contains the hyperlink.

Thanks for the reply, but I have got no idea on what to do with what you have suggested.

I dont understand if this should go in code and where. I am a complete novice to coding and you guys are teaching me loads.

Where do I do this?

Ta
 
Got it,

tried playing about and got it to work

If Len(strInputFileName) > 0 Then
DocumentLink = strInputFileName & "#" & strInputFileName

Thats what I tried, and thats what works, so thanks.

Learn something new each day! lol
 

Users who are viewing this thread

Back
Top Bottom