Delete Report After E-Mailing

quest4

Registered User.
Local time
Today, 04:51
Joined
Oct 12, 2004
Messages
246
Good morning, I have an OnClick procedure, that creates a snapshot report document, which is outside of the dbase, but in the same directory, My Documents. I would like to delete it after it is e-mailed and I tried playing with DoCmd.DeleteObject but that appears to be for things inside of the dbase. How can I delete the snapshot? Thank you to anyone helping me. :confused:
 
Thank you for your response, Bob. I will give it a try, but I never hear of kill in Access VB, but I used kill in UNIX scripts allot.
 
Dont forget to check if the file exists first. Kill will error out if the file does not exist.
 
Thanks for the response Ray. but how do I check on a file outside of the dbase?
 
you can do something like

Code:
If Dir("C:\Test.txt") <> "" Then
  Msgbox "File exists"
Else
  Msgbox "File does not exist"
End If
If the file has special attributes (eg: is Hidden) you need to specify this too, eg:

If Dir("C:\Test.txt", vbHidden) <> "" Then
  Msgbox "File exists"
End If

http://www.vbforums.com/archive/index.php/t-349990.html
 
Thanks again for all of the help Ray, I will try it shortly. I do have one last dumb question here, is the a way to make that full patname a globe variable so I only need to change it in one place? It is now used in almost a dozen procedures.
 
not exactly sure on this but i think you might be able to do

Public filepath as string =Dir("C:\Test.txt")

Someone probably knows more than me on this
 
Thanks again Ray, I will give that a try, after I amke a copy of the dbase. Se, mama did not raise a fool. Thanks again and I am now done.
 
Ray, I am getting a compile error: Expected: End of statement and it hilites the = and the entire line of code is red. Any thoughts on this? Thanks again.
 

Users who are viewing this thread

Back
Top Bottom