Is there any way to determine the file date of a file attachment?

My intention is to roll out a file to our users.

The file is attached to a hidden document in a database. When that database is opened, I have some simple script to check if the file exists on disk. If it doesn’t, it is then detached to the appropriate spot.

Periodically, this file will be updated and re-attached to the document. I would like to be able to compare the file date of the file on disk (using the FileDateTime function) with that of the attached file, and overwrite the file if an update has been made.

Unfortunately, I cannot see any properties when I get a handle to the file attachment object.

Is there any way to accomplish this without detaching the file to a temporary spot and comparing the dates that way? That just seems to me like an expensive operation to undertake every time the user opens the database.

Any suggestions would be very much appreciated!

Cheers,

T.

Subject: Is there any way to determine the file date of a file attachment?

will there always be just 1 attached file or could there be more than 1?

Subject: RE: Is there any way to determine the file date of a file attachment?

Thanks for your response Paul. I think I have the solution now (see my own response).

In fact, there were several files attached (should have added that to my original post!).

By using the method described in my response, I have been able to successfully compare each file with its on-disk counterpart, and replace where necessary.

Cheers!

T.

Subject: RE: Is there any way to determine the file date of a file attachment?

glad you worked it out

Subject: Sorry, I should’ve looked harder before posting this!

For anyone else with the same requirements, I ended up using code similar to the following to establish the file names/dates attached to a document…

attFileNames = Evaluate( |@AttachmentNames|, configDoc )

attFileDates = Evaluate( |@AttachmentModifiedTimes|, configDoc )

Those functions return lists, which I can then use to compare each file with its counterpart on disk, and replace the outdated file if necessary.

Hope that helps someone else out!

T.