Do this:
Me.txtFlaggedDocumentLink = "#" & fileName
John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of jfakes.rm
Sent: Thursday, May 09, 2013 10:43 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Allowing a user to select a file and insert a
hyperlink to the file
I'm trying to create a command button on a form that allows a user to browse
to a file and once selected, insert the hyperlink to the file.
The hyperlink address needs to be saved in a field called:
txtFlaggedDocumentLink (which is a hyperlink field).
I've pieced together the following after searching the web, however, while
the path to the filename is saved correctly, when I click on the link, it
doesn't work. It appears to be a hyperlink, but it won't work.
Private Sub cmdFindFile_Click()
'Sub getFileName()
' Displays the Office File Open dialog to choose a file.
Dim fileName As String
Dim result As Integer
With Application.FileDialog(1) ' 3 is a constant: msoFileDialogFilePicker
.Title = "Select File"
.Filters.Add "All Files", "*.*"
.FilterIndex = 1
.AllowMultiSelect = False
'.InitialFileName = CurrentProject.Path
' This opens the NCQA library folder to start the search.
.InitialFileName = "\\Rmregfile017\ncqalibrary"
result = .Show
If (result <> 0) Then 'result = 0 if nothing was selected fileName =
Trim(.SelectedItems.Item(1)) 'filename contains the path you want.
Me.txtFlaggedDocumentLink = fileName
End If
End With
End Sub
Any suggestions?
I also tried,
------------------------------------
Yahoo! Groups Links
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar