Unanswered: Inserting and opening Hyperlinks
I'm having some issues with a smal database of mine, that has a table with paths / files of documents related to a given record.
Using the code:
So basically it opens a filedialog and inserts the select path into the table record formatted as hyperlink.
Dim fd As FileDialog
Dim filen As String
Dim valg As Integer
Dim sql As String
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
fd.InitialFileName = "F:\USER\Medie- og Markedsafdelingen\"
filen = fd.SelectedItems(1)
sql = "INSERT INTO md_tbl_dokumenter(prodid, sti, dato) VALUES(" & Str(Forms![md_mainmenu]!Prod_ny!txt_id) & ",'" & filen & "'," & Date & ")"
DoCmd.Close acForm, "md_frm_stivalg", acSaveNo
However, if I click the link afterwards it doesn't open, but only activities the web toolbar in access.
If I type the link manually into the table, there's no problem, so apparently there's a difference in the formatting of the hyperlink when using filedialog and when typing, or???
Is there anything I can do to manipulate the path before adding it to the insert statement? other workarounds? Surely something simple!?!?
Thanks in advance
P.S. I just checked. A path added to the hyperlinks record in the table through filedialog is straightforward when conerted to text (e.g. F:\USER\Medie- og Markedsafdelingen) whilst one typed in manually has #F:\USER\Medie- og Markedsafdelingen#. So the # should somehow be added.... I'm not sure if it'll work just adding it to the string, but I'll post later.
P.P.S. I seem to have solved the problem changing the INSERT clause to
sql = "INSERT INTO md_tbl_dokumenter(prodid, sti, dato) VALUES(" & Str(Forms![md_mainmenu]!Prod_ny!txt_id) & ",'#" & filen & "'#," & Date & ")"
Last edited by Trinsan; 03-20-06 at 06:32.
IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....