("\\Qes1\data\Initial Data\C005900*.pdf"
and if that file exist grab the full file path an create a hyperlink to the file
Expand|Select|Wrap|Line Numbers
- Private Sub cmdPopulateHyperlink_Click()
- 'First, set a Reference to the Microsoft Office XX.X Object Library
- 'Dim strButtonCaption As String, strDialogTitle As String
- Dim strHyperlinkFile As String
- 'Define your own Captions if necessary
- strButtonCaption = "Save Hyperlink"
- strDialogTitle = "Select File to Create Hyperlink to"
- With Application.FileDialog(msoFileDialogFilePicker)
- With .Filters
- .Clear
- .Add ".PNG Files", "*.*" 'Allow only *.png File types
- End With
- 'The Show Method returns True if 1 or more files are selected
- .AllowMultiSelect = False 'Critical Line
- .FilterIndex = 1 'Database files
- .ButtonName = strButtonCaption
- .InitialFileName = "\\Qes1\data\Initial Data\C005900*.*"
- .InitialView = msoFileDialogViewDetails 'Detailed View
- .Title = strDialogTitle
- If .Show Then
- For Each varItem In .SelectedItems 'There will only be 1
- 'Extract Caption and and add Address of Hyperlink (Caption#Address)
- strHyperlinkFile = Mid$(varItem, InStrRev(varItem, "\") + 1) & "#" & varItem
- Me![Link] = strHyperlinkFile
- Next varItem
- End If
- End With
- End Sub
All of the files are unique based on the CXXXXXX. Is there anyway to do this?
Edit: I am using access 2010