Checking to see if multiple versions of db are open

Jibbadiah

James
Local time
Today, 18:00
Joined
May 19, 2005
Messages
282
Gents/Ladies,

I have created a database with an "on-open" function that creates a temporary directory and certain program files on the local drive of a users pc. This directory is used for FTP and archiving of sensitive customer data, so when the database is closed it runs code that deletes all files on exit.

This functionalty works fine - however I am a total numpty :(, and I regularly open multiple sessions of the same database - (because it has loads of cool but totally different functionality). If I close one version I inadvertently remove all files that the other session may want to use.

I realise that you can use the following useful code:

If Len(Dir(<filename>)) > 0 Then Blah blah {Checks file existence}

If FileLen(<filename>) = 0 Then blah blah {Ensures file isn't zero bytes}

Hence I can check that .ldb exists etc... But can I check that the same database is open twice by the same person before I allow the script to delete files?

Cheers,

James
 
Ideas...

Make each session dynamically create uniquely named external files. Use the date and time for a filename, since it's pretty unlikely you could open a new instance within a hundredth of a second.
Then each session always creates and deletes it's own files.
 
lagbolt,

Nice one mate... like the simplicity... cheers!! :)

J.
 

Users who are viewing this thread

Back
Top Bottom