Delete files with command button (1 Viewer)

RodShinall

Registered User.
Local time
Yesterday, 18:05
Joined
Dec 21, 2006
Messages
32
I created a personal household inventory database for homeowner's insurance purposes. Each record contains data related to a household item such as a TV, table, etc. Each item has two associated .jpg files which show a photo of the item and related documents. These .jpg files are in the same folder as the database .mdb file. Each record contains an ItemNumber field and I assign each household item a unique number such as AP001. Each .jpg file is similarly named such as AP001.jpg and AP001-Doc.jpg. I placed a command button on my form to delete records no longer needed but must manually delete the associated .jpg files. When I click my command button to delete a record I want to automatically delete the .jpg files as well. Any help would be greatly appreciated. I am using Access 2003.
 

DCrake

Remembered
Local time
Today, 00:05
Joined
Jun 8, 2005
Messages
8,632
This subject is something very close to my heart as I have already written a program that does the same thing but with more security around it.

Let me point out a couple of things to consider.

1. Don't store the data base on the same machine as the front end. If some nicks the computer they have access to all the valubles in your property.

2. Why limit the number of images, mine is unlimited.

3. Have the facility to be able to scan douments and save in same folder.

4. Get the approval of the local Police anti crime personell.

5. What happens if my fiend lets me take a picture of his Rolex watch, lets me scan his receipt and I then report it to the police that I have had it stolen? I have picyures and a valid receipt for it so I must have had one to start with. How can the Insurance company disprove it.

6. Make sure that the data tables remain anonomous. If it does get into the wrong hands then looking at the data won't reveal the owners details.


Going back to your orignial question use Kill NameOfImage to delete an image from the hard drive.

David
 

DCrake

Remembered
Local time
Today, 00:05
Joined
Jun 8, 2005
Messages
8,632
Just to let you into a little secret re my first point.

My system gets the database from a secure web server via FTP when the application is launched by using the licence key as the identifier. When the user has updated their database it fires it back to the web server via FTP and deletes the local copy. Any images are embedded in to a temp table in a seperate mdb that is create on the fly. As soon as it hits the hard drive the images are recreated again in the target folder.

When the user selects an item any linked images, scanned documents, etc are displayed in a thumbnail viewer.

If the user does not have internet access then a memory stick is used as the secure storage area instead of the FTP site.

My next stage in its development is to sell the license to the insurance companies who will offer it a part of a policy. That way the users uses the insurance compainies secure web server of the target FTP.

It is currently written in VB.6 but ideally I would like to move it to a web based version but I do not have the skills.

David
 

RodShinall

Registered User.
Local time
Yesterday, 18:05
Joined
Dec 21, 2006
Messages
32
Thank you, DCrake, for your suggestions. You have given me much to consider.

I am aware of Kill but I can't quite figure out how to write code to make it grab the ItemNumber stored in the record to be deleted. I tried the following but it didn't work:

Kill "D:\HHInventory\" & cboItemNumber.Value & "*"

Thanks
 

DCrake

Remembered
Local time
Today, 00:05
Joined
Jun 8, 2005
Messages
8,632
First of all the value in your combobox should be the actual name of the file you want to delete.

Image000.BMP - Contents of Combo box column 2

Then you need to perform a dir to check for its existance

Code:
If Dir("D:\HHInventory\" & Me.ComboBox.Column(1)) <> "" Then
    Kill "D:\HHInventory\" & Me.ComboBox.Column(1)
End If

David
 

RodShinall

Registered User.
Local time
Yesterday, 18:05
Joined
Dec 21, 2006
Messages
32
Thank you very much, David. This worked like a charm. Just what I needed.

Rod
 

Users who are viewing this thread

Top Bottom