By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,714 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,714 IT Pros & Developers. It's quick & easy.

Overwrite File -"Yes"

P: n/a
Access 2k

Exporting a Query to as an excel file. No problem.

However, I keep getting the warning that the file already exists, Overwrite
Yes/No.

Yes, I want to overwrite the file. SetWarnings On/Off has no affect.

Any suggestions appreciated.

Thanks in advance.


"And.... Exactly at which point did you consider this a good idea?"
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
> Access 2k

Exporting a Query to as an excel file. No problem.

However, I keep getting the warning that the file already exists, Overwrite
Yes/No.

Yes, I want to overwrite the file. SetWarnings On/Off has no affect.

Any suggestions appreciated.


Have you considered checking to see if the filename exists and, if so, delete
the file prior to doing the export?

--
Bruce M. Thompson, Microsoft Access MVP
bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access)
NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<
Nov 12 '05 #2

P: n/a
In article <vr************@corp.supernews.com>, "Bruce M. Thompson"
<bthmpson@big_NOSPAM_foot.com> writes:
Have you considered checking to see if the filename exists and, if so, delete
the file prior to doing the export?


I know how to check for the existance of the file. For fear of looking stupid
(not the first time) what would be the syntax for deleting the external file?
(i.e.: C:\MyDir\MyFile.xxx)

Else, I guess I could run a batch routine prior to running the Access App.

"And.... Exactly at which point did you consider this a good idea?"
Nov 12 '05 #3

P: n/a
"Clint Stowers" <cl*******@aol.comNoSpam> wrote in message
news:20***************************@mb-m04.aol.com...
In article <vr************@corp.supernews.com>, "Bruce M. Thompson"
<bthmpson@big_NOSPAM_foot.com> writes:
Have you considered checking to see if the filename exists and, if so, deletethe file prior to doing the export?
I know how to check for the existance of the file. For fear of looking

stupid (not the first time) what would be the syntax for deleting the external file? (i.e.: C:\MyDir\MyFile.xxx)


Kill "path to file"

(there is no warning and it doesn't move the file to the recycle bin so use
with caution).
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #4

P: n/a
In article <bp*************@ID-98015.news.uni-berlin.de>, "Rick Brandt"
<ri*********@hotmail.com> writes:
Kill "path to file"

(there is no warning and it doesn't move the file to the recycle bin so use
with caution).


Working as advertised. Thanks.

"And.... Exactly at which point did you consider this a good idea?"
Nov 12 '05 #5

P: n/a
A "safer" way is to Name the file to a backup first and then write your file
out so

Where original file is C:\MyDir\MyFile.xls

' *********************************************
' Code Start
Const FILE_TARGET = "C:\MyDir\MyFile.xls"
Const FILE_BACKUP = "C:\MyDir\MyFile.bak"

If Len(Dir(FILE_TARGET)) > 0 Then
If Len(Dir(FILE_BACKUP)) > 0 Then
Kill FILE_BACKUP
End If
Name FILE_TARGET As FILE_BACKUP
End If

' Code to output the new file to FILE_TARGET
' Code End
' *********************************************

Terry
"Clint Stowers" <cl*******@aol.comNoSpam> wrote in message
news:20***************************@mb-m03.aol.com...
In article <bp*************@ID-98015.news.uni-berlin.de>, "Rick Brandt"
<ri*********@hotmail.com> writes:
Kill "path to file"

(there is no warning and it doesn't move the file to the recycle bin so usewith caution).


Working as advertised. Thanks.

"And.... Exactly at which point did you consider this a good idea?"

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.