Link to home
Create AccountLog in
Avatar of G Scott
G ScottFlag for United States of America

asked on

RT Error 2587 Can't complete Output operation

I am running the following code:

 
Dim fd2 As FileDialog
Dim Title2 As String
Dim vrtSelectedItem2 As Variant

Set fd2 = Application.FileDialog(msoFileDialogSaveAs)

With fd2
  
  .AllowMultiSelect = False
  .Title = "Save File"
  .InitialFileName = "Interiors By Workstream.xls"

     If .Show = True Then
       DoCmd.OutputTo acOutputReport, reportName, acFormatXLS, .SelectedItems(1), True

     Else
       MsgBox "No file was selected"
     End If
End With

Open in new window




It was working, now it does this upon an Office 2007 re-install. I had given me the 2587 error saying it can't complete the Output operation..and I have also seen something like format isn't available or soemthing like that.


Also, it doesn't work at all in Runtime. I have been all over EE and I know it is a known bug of sorts. Is there an alternative way to export a report to Excel? Reason I want to do the Report is I have subtotals calculated on the Report and the users like the way it 'was' coming out in Excel upon export.

Any other solutions to this problem will be more than welcomed.

ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of G Scott

ASKER

you have..I will give it a try.

Stand by.
Avatar of G Scott

ASKER

I followed this procedure:

 
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
       >>Debug>>Compile
        Note ... after the word Compile ...you will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

Open in new window


And it is still not working.

Not sure if you can take a look : \
SampleDB.accdb

It has been working just fine, on the PC I am on now, and on my laptop. Now it doesn't work in either place. Which I find VERY strange. Thanks for taking a look, whenever you get a chance.
Avatar of G Scott

ASKER

Ok, so after doing a bit of troubleshooting I found something interesting. An older version of this same application works on my laptop. Exports just fine. When I run it on my desktop, it errors out saying it can't do the OutPut.  

My worry is, the end users have RunTime and if I cannot get the export to work correctly then they can't use my DB at all.