Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 18th, 2009, 10:25 AM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default Delete files with command button

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.
Reply With Quote
  #2 (permalink)  
Old December 28th, 2009, 09:49 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there..

Use the command Kill (Kill "C:\Your_Folder\Yourfile")
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
  #3 (permalink)  
Old December 30th, 2009, 09:02 AM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2009
Posts: 14
Thanks: 4
Thanked 0 Times in 0 Posts
Default Delete Files with Command Button

Thank you for your reply. This is what I needed.
RodM
Reply With Quote
  #4 (permalink)  
Old March 2nd, 2010, 09:48 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

This will not happened if your file is lock by some application
Reply With Quote
The Following User Says Thank You to ayazhoda For This Useful Post:
RodM (March 7th, 2010)
  #5 (permalink)  
Old March 5th, 2010, 09:08 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Rod, just a thought.

If you ever need to get any of those back, you will be messed up by deleting them. If you ever decide you don't need a record anymore, don't delete it. Instead, tag it as inactive. Have your form filiter so that the default is it only shows active records. Later, if you change your mind, you can filter for inactive records and untag the desired one. All will be there.
__________________
Greg Serrano
Michigan Dept. of Environmental Quality
Air Quality Division
Reply With Quote
The Following User Says Thank You to SerranoG For This Useful Post:
RodM (March 7th, 2010)
  #6 (permalink)  
Old March 5th, 2010, 09:55 AM
Friend of Wrox
 
Join Date: Apr 2007
Location: , , .
Posts: 110
Thanks: 1
Thanked 2 Times in 2 Posts
Send a message via MSN to ayazhoda
Default

Just to add few more bit as additional review

1. Its better to send them recycle bin first as kill will delete file for ever ( may be user click wrong button and wants to recover later on.

2. Make sure file must not be used by someone else by the time you are deleteing it.

3. You can set a bool variable to show them or not, insted of deleting them

4. What would happen in 6 months time you need that file again
Reply With Quote
The Following User Says Thank You to ayazhoda For This Useful Post:
RodM (March 7th, 2010)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
GridView Delete Command jamara ASP.NET 2.0 Professional 0 February 23rd, 2007 02:16 PM
'Hidden' Command Button David Mulvey Word VBA 0 January 9th, 2007 11:21 PM
Command Button Question eoghang Excel VBA 2 September 25th, 2006 08:33 PM
command button qry mohiddin52 Access 0 December 22nd, 2003 08:20 AM



All times are GMT -4. The time now is 05:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.