Create hyperlink by using VBA in conjuntion with API0001 Dialog Bo

L

lgray

I am looking for direction on how to insert a hyperlink into a table field
that has been designated as "Hyperlink" by using VBA that will look to an
input form for the correct path. Currently, the Hyperlink field updates the
field with the data, but when I click on the field to access the hyperlink,
nothing happens.
 
L

lgray

Alex,
As for VBA experience, I'm still in the piecing it all together and finding
the "Correct Code" in my learning curve of VBA. What would be the command or
syntax to create the hyperlink. To help you answer this question, the
scenario is as follows.
The supervisor requests that I create a function where, on a click, a Dialog
Box comes up, then the file is selected and saved to a different directory.
(This part works, with the help of the MVP assistance). But the supervisor
also want a hyperlink to be created in a table as part of this same function,
so that the employees will be able to open a form, click on the hyperlink and
more quickly be able to find their files that they are collecting as a group.
(ie Word docs, pdfs, Excel spreadsheets etc that are all related to the same
project). I am easily able to update/add a file path to the Hyperlink field,
but when I click on the Hyperlink, nothing happens. It is here that I am
lost in Code. So, more specifically, how do I apply the instructions you
have provided to me.
 
L

lgray

Alex
I thought I had the code for the Hyperlink worked out, but cannot seem to
get it to work dynamically with my API001 - Dialog Box function. Can you
review and see if you know how to reference the values in the Dialog box. It
needs to insert the value of strOutputFileName, not a hard coded file path.

Thanks,
Function SaveFileCodeWorks4()
Dim strFilter As String
Dim strInputFileName As String
Dim strOutputFileName As String

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.XLS")
strFilter = ahtAddFilterItem(strFilter, "doc Files (*.doc)", "*.DOC")
strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)", "*.DBF")
strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)", "*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")

strOutputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=False, _
DialogTitle:="Please select an Output Destination...", _
Flags:=ahtOFN_HIDEREADONLY)
CurrentDb().Execute "INSERT INTO Encroachment_Attachments (Attachment) " & _
"VALUES ('Attachments#" & _
"C:\Test.doc##" & _
"C:\Test.doc');", dbFailOnError
CurrentDb().Execute "INSERT INTO Encroachment_Attachments (Attachment " & _
"VALUES ('"


End Function
 
L

lgray

Alex,
I couldn't use your code, but was provided by one of the fellow MVPs the
following code which worked.

If Len(strOutputFileName) > 0 Then
CurrentDb().Execute "INSERT INTO Encroachment_Attachments (Attachment) " & _
"VALUES ('Attachments#" & _
strOutputFileName & "##" & _
strOutputFileName & "');", dbFailOnError
End If

Thanks for you help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top