Hello all,
I'm new here and not very experienced with access, so I hope you'll forgive me for posting a question without first posting advice (and also for my wonky use of terminology!).
I'm currently working on a way to import data from many word documents into a table - I've got this working fine using the following code:
However, I'm wanting to add a link to those files to the table so that the user can click on the record (or select one and then use a button) to open each document in it's native environment (MS Word). I've tried adding a self-referencing hyperlink to a form in the word document and then reading that in - but that doesn't seem to work. As these files may move around (and there are a lot of them) I need to make sure it's done automatically so can't really get the user to write it in manually.
Any help would be immensely appreciated!
All the best,
Ziggy
I'm new here and not very experienced with access, so I hope you'll forgive me for posting a question without first posting advice (and also for my wonky use of terminology!).
I'm currently working on a way to import data from many word documents into a table - I've got this working fine using the following code:
Code:
Private Sub bImportFiles_Click()
On Error GoTo bImportFiles_Click_Err
Dim objFS As Object, objFolder As Object
Dim objFiles As Object, objF1 As Object
Dim strFolderPath As String
strFolderPath = "C:\Users\zigex\Documents\Super Project\testfiles\"
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFS.GetFolder(strFolderPath)
Set objFiles = objFolder.files
For Each objF1 In objFiles
If Right(objF1.Name, 3) = "txt" Then
DoCmd.TransferText acImportDelim, "Monthly Import Specification", "monthlyimport", strFolderPath & objF1.Name, False
Name strFolderPath & objF1.Name As "C:\Users\zigex\Documents\Super Project\testfiles" & objF1.Name 'Move the files to the archive folder
End If
Next
Set objF1 = Nothing
Set objFiles = Nothing
Set objFolder = Nothing
Set objFS = Nothing
bImportFiles_Click_Exit:
Exit Sub
bImportFiles_Click_Err:
MsgBox Err.Number & " " & Err.Description
Resume bImportFiles_Click_Exit
End Sub
However, I'm wanting to add a link to those files to the table so that the user can click on the record (or select one and then use a button) to open each document in it's native environment (MS Word). I've tried adding a self-referencing hyperlink to a form in the word document and then reading that in - but that doesn't seem to work. As these files may move around (and there are a lot of them) I need to make sure it's done automatically so can't really get the user to write it in manually.
Any help would be immensely appreciated!
All the best,
Ziggy