Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-11-08
6
Medium Priority
?
652 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 2000 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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Technology Partners: 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!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

705 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