Error Number 2302
Contents |
Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts microsoft access can't save the output data to the file you've selected Go to Page... Thread Tools Rating: Display Modes 04-06-2006, 07:04
Access Exportwithformatting
AM #1 odun Registered User Join Date: Apr 2005 Posts: 108 Thanks: 0 Thanked 0 Times
Error 2032
in 0 Posts runtime error 2302 Hello all, I am getting this error when I use another machine, but it works fine on another machine, how do I ensure this code works on all machines: Code: Private Sub Command53_Click() DoCmd.OutputTo acQuery, "QueryDetails", "MicrosoftExcel(*.xls)", "c:\ Query Details.xls", True, "" End Sub the error is: Can't save the output data to the file you've selected. The excel file is not open and it's not a template. Access creates the excel file everytime the code is runs and there is enough disk space. Please help. Thanks! odun View Public Profile Find More Posts by odun 04-06-2006, 07:23 AM #2 ghudson Newly Registered User Join Date: Jun 2002 Location: USA Posts: 6,199 Thanks: 1 Thanked 74 Times in 43 Posts I noticed that your format option is odd. It should be "acFormatXLS" The OutputTo function has other limitations. Why not use the TransferSpreadsheet() function? I also noticed that you have a space in between the \ and the file name. "c:\ Query Details.xls" OutputTo Method TransferSpreadsheet Method __________________ .................................................. ......Searching this forum or Microsoft.com or MSDN.com or Google is a great way to discover and learn the answers to your Access programming questions. Well if it seems to be real, it's illusion... I am using Access 2010 with Windows 7 The To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. function on this forum really does work. To view links or images in signatures your post count must be 1
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, http://www.access-programmers.co.uk/forums/showthread.php?p=480441 helping each other. Join them; it only takes a minute: Sign up Docmd.OutputTo Excel - “Microsoft Access can't save the output data to the file you've selected” up vote 0 down vote favorite 1 I am exporting some data to excel using a Docmd.Output. FileName = "CategoryBreakdown.xls" DoCmd.OutputTo acOutputStoredProcedure, sqlSP, acFormatXLS, FileName, True The error occurs when http://stackoverflow.com/questions/33902831/docmd-outputto-excel-microsoft-access-cant-save-the-output-data-to-the-file I've already exported the data once, and there is an open excel spreadsheet named "CategoryBreakdown.xls". Is the best practice to use On Error and show a message telling the user to close the spreadsheet/save it under a different name? Or is there a way to check during runtime if there is a file open with that name and to provide a different file name before it crashes? Thanks vba ms-access access-vba ms-access-2007 share|improve this question edited Nov 24 '15 at 20:17 asked Nov 24 '15 at 20:07 lhsoftware 8311 add a comment| 3 Answers 3 active oldest votes up vote 0 down vote accepted As understood from you, you want to keep the previously exported excel files as well as the new exports. so what you can do is to create a public function within a module, and an public increment variable, then call that function on a button click event and on the error 2302 as well... The public function Option Compare Database Dim i As Integer Public Su
sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the http://www.dbforums.com/showthread.php?673438-Run-time-error-2302 register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. Results 1 to 4 of 4 Thread: Run-time error 2302 Tweet Thread Tools Show Printable Version Subscribe to this Thread… Search Thread Advanced Search Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-30-03,08:25 #1 error number Bonnie View Profile View Forum Posts Registered User Join Date Jul 2002 Posts 7 Unanswered: Run-time error 2302 I am getting run-time error 2302 "can't save the output data to the file you've selected." I am outputting an Access 97 report to an .rtf format on our shared drive. This report is created every day usually with no problem, error number 2302 but once in awhile this error occurs and the procedure bombs. How can I determine why it is happening or how to error trap for it so I can skip this step and continue on with the next step? Thank you. Reply With Quote 01-30-03,08:46 #2 JTRockville View Profile View Forum Posts Registered User Join Date Jan 2003 Location Rockville, MD Posts 179 Perhaps the disk is full? Or the file name contains one of following invalid characters !@#$%^&*():;? Or the folder got deleted? You can trap the error like this Code: Sub BonniesProcedure() On Error Goto BonniesProcedure_Err DoCmd.OutputTo acOutputReport, "Bonnies Report", acFormatRTF, "Z:\Shared Folder", True On Error Goto 0 Exit Sub BonniesProcedure_Err: If Err = 2302 Then 'insert code you want to execute when that error occurs End If Resume Next End Sub Or you can just proceed to the next step like this Code: Sub BonniesProcedure() On Error Resume Next DoCmd.OutputTo acOutputReport, "Bonnies Report", acFormatRTF, "Z:\Shared Folder", True On Error Goto 0 Exit Sub Reply With Quote 01-30-03,10:54 #3 Bonnie View Profile View Fo