capture latests file for hyperlink

I

icq_giggles

I have a database with references to live documents. These documents (PDF
files) update periodically and I need to make sure I have the latest version
- can this be done with the filedatetime function? The filename changes - if
original is NNNN.pdf, then the revision is NNNNA.pdf - the NNNN is constant
and I have a field with that information.

I found this code and tweaked it to my needs but it only appends - I need
updates, which it gives me an error on, and I only need the newest file.

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

I hope I've explained this well enough - any help is appreciated!
 

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