Solved

Can I Stop Access 2007 from asking "Do You Want To Replace The Existing File?

Posted on 2013-11-08
6
628 Views
Last Modified: 2013-11-19
I am using Access 2007 and have what I believe is a simple Macro. I basically want to output a Report to a folder on my PC. Each time I run the Macro it asks me "Do I want to replace the existing file? (I do not want to see this prompt)
I attached a jpeg of the Macro Action Arguments that I used alng with the prompt.

Is there a simple way to eliminate the prompt as I want to run this Macro as an
"AutoExec" macro?

If there is special coding to be done, please explain where as I am not an Access Expert.

Any help would be greatly appreciated.
Rick
AccessMacroError.jpg
0
Comment
Question by:ES-Components
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 39633809
If you delete the file first, it will not prompt to replace.

Here is a function yu can put in a standard module and call from a macro


Public Function KillProperly(pKillfile As String)
    If Len(Dir(pKillfile)) > 0 Then
        SetAttr pKillFile, vbNormal
        Kill pKillFile
    End If
End Function

Open in new window

0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39633812
change the action OutputTo in your macro with

RunCode




Function Name ExportReport()


then create this function in a regular module

Function exportReport()
Dim fPath As String, fName As String
fPath = "\\Server\escfiles\Intranet\ControlPanel\Word\"
fName = "ARCollections-All.rtf"

If Dir(fPath & fName) <> "" Then Kill fPath & fName
DoCmd.OutputTo acOutputReport, "ARCollections-All", acFormatRTF, fPath & fName, no, , , acExportQualityPrint
End Function



.
0
 
LVL 21
ID: 39634095
I forgot to add that you would add the following before the Output line:

Action: RunCode
KillProperly("\\Server\escfiles\Intranet\ControlPanel\Word\ARCollections-All.rtf")
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ES-Components
ID: 39634280
capricorn1
I think I got it to work. But there is another error.
Any ideas as to how to get this fixed?
See attached jpeg's for macro and error message

Thank you...
Rick
AccessMacro2.jpg
AccessMacro2Error.jpg
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39634321
read the messages from the error window,
check if any of those applies to your case, it is pretty straightforward
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 39661167
;-) ?
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question