C
Carlos
Hello,
I would like Access to search a specified folder for files (all of the files
in the specified folder are .doc files) and enter the filenames into a field
in a table as a hyperlink. I am currently using the following function:
Function LocateFile(strFileName As String)
Dim vItem As Variant
Dim db As DAO.Database
Set db = CurrentDb
With Application.FileSearch
.FileName = strFileName
.LookIn = "C:\Tests\Proposed"
.SearchSubFolders = True
.Execute
For Each vItem In .FoundFiles
db.Execute _
"INSERT INTO Tests (Proposed Tests) " & _
"VALUES(" & Chr(34) & vItem & Chr(34) & ")", _
dbFailOnError
Next vItem
End With
Set db = Nothing
End Function
This works fine at entering the filenames into the table, but they do not
work as hyperlinks to the files. I have the data type of the field set to
Hyperlink, but the text that is entered into the field is not linked to
anything.
Can anyone help me with this problem?
Thanks
I would like Access to search a specified folder for files (all of the files
in the specified folder are .doc files) and enter the filenames into a field
in a table as a hyperlink. I am currently using the following function:
Function LocateFile(strFileName As String)
Dim vItem As Variant
Dim db As DAO.Database
Set db = CurrentDb
With Application.FileSearch
.FileName = strFileName
.LookIn = "C:\Tests\Proposed"
.SearchSubFolders = True
.Execute
For Each vItem In .FoundFiles
db.Execute _
"INSERT INTO Tests (Proposed Tests) " & _
"VALUES(" & Chr(34) & vItem & Chr(34) & ")", _
dbFailOnError
Next vItem
End With
Set db = Nothing
End Function
This works fine at entering the filenames into the table, but they do not
work as hyperlinks to the files. I have the data type of the field set to
Hyperlink, but the text that is entered into the field is not linked to
anything.
Can anyone help me with this problem?
Thanks