Solved

Saving Report as PDF - Save As Prompt

Posted on 2002-07-11
2
245 Views
Last Modified: 2012-08-14
I'm using the following code to save a report as a PDF file.  Everything works but the Save As box pops up requesting a file name and another box after that asking whether or not I want to replace the existing file.  I want it to automatically save the file and replace the existing file.  How can I do this?

Thanks.
______________________________________
   Dim db As Database
   Dim rs As Recordset
   Dim rpt As Report
   Dim strReportName As String
 
   strReportName = "Report1"
   
   Set db = CurrentDb
   Set rs = db.OpenRecordset("DevStructure")
       
   DoCmd.OpenReport strReportName, acViewDesign
       
   Set rpt = Application.Reports(strReportName)
           
   rs.MoveFirst
   rpt.PrtDevMode = rs.Fields(0)
   rpt.PrtDevNames = rs.Fields(1)
   rs.Close
   
   DoCmd.OpenReport strReportName, acViewNormal
   DoCmd.Close acReport, strReportName, acSaveNo
0
Comment
Question by:drees727
2 Comments
 
LVL 28

Accepted Solution

by:
TextReport earned 100 total points
Comment Utility
you can delete the old file before doing the save Kill "filename". As far as the prompt for the filename all i can think of is to try sendkeys "c:\...~" the ~ will do an enter and you may want to try this first without the ~ to test that the keys are been sent to the correct window.

Cheers, Andrew
0
 

Author Comment

by:drees727
Comment Utility
Using the sendkeys worked.  Thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now