DoCmd.OutputTo, 2007 - 2000

SeanD

Registered User.
Local time
Today, 16:35
Joined
Mar 9, 2011
Messages
62
I have some code, working in Access 2007.
I want it to work in Access 2000 also.

The export from a table works fine:
DoCmd.OutputTo acOutputTable, "Data", acFormatXLS, , -1

The export from a query does work in Access 2007 but not in Access 2000:
DoCmd.OutputTo acOutputQuery, "Temp_N°_Code", acFormatXLS, , -1

Any help?
 
Access denied to "NameOfQuery"

or

Microsoft acces could not save the selection
 
I don't know :)

If I wan't to export a table, it doesn't give error messages.

If I try a query, it just won't work in Access 2000.
 
Ok, what I mean is, what actions do you take to get those two error messages?
 
I tried it again and now I get this 1 Error Msg:
Access denied to "NameOfQuery"
 
Ok, what I mean is, what actions do you take to get those two error messages?
I just click the button ^^

Code:
Private Sub Exporter_Click()

On Error GoTo Err_Exporter_Click

DoCmd.OutputTo acOutputQuery, "Temp_N°_Code", acFormatXLS, , -1

Exit_Exporter_Click:
    Exit Sub

Err_Exporter_Click:
    MsgBox Err.Description
    Resume Exit_Exporter_Click
    
End Sub
 
Run the code like this:
Code:
Private Sub Exporter_Click()

    DoCmd.OutputTo acOutputQuery, "Temp_N°_Code", acFormatXLS, , -1

End Sub
So when you click the button now which error message do you get?
 
In Access 2007 this work fine.
When I use another computer who runs access 2000, An Excel-file opens and the error messages appears:
access denied to "NameOf Query".
 
It would appear that the database is using user-level security and in the workgroup file for that db your username doesn't have the rights to administer that query. Just a thought.
 
Actually, it might be that you don't have the rights to save into that folder. So it could be a Windows alert.

Right click inside that folder and try to create a text file. If you can then this isn't the problem.
 
Actually, it might be that you don't have the rights to save into that folder. So it could be a Windows alert.

Right click inside that folder and try to create a text file. If you can then this isn't the problem.

I save it on the desktop, and I can create text-files there ;)

Is there an other way to export data to excel?
 
It is most likely a user-level security issue. The user on that machine doesn't have the access to manipulate that query.
 
One more thing to try. Does it allow you to export the query to xls using the Import/Export wizard?
 
success with the tables, but not with the queries
 
I'm the admin lol ^^
But found the problem.
-1 was not accepted.

DoCmd.OutputTo acOutputTable, "Data", acFormatXLS

this works fine.
 
Rather odd. Not a very descriptive error message and you should be able to get the app to auto start.
 

Users who are viewing this thread

Back
Top Bottom