Go Premium for a chance to win a PS4. Enter to Win

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
?
664 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
  • 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

877 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