Outputto method

durdle

Registered User.
Local time
Today, 16:41
Joined
May 7, 2002
Messages
130
Hi all,

I have having some trouble with the OutputTo method. I know I am missing the object name but not sure how to put it in. The correct syntax is

DoCmd.OutputTo objecttype[, objectname][, outputformat][, outputfile][, autostart][, templatefile]

and the code I have is

Private Sub Command29_Click()

DoCmd.OutputTo acOutputQuery, acFormatXLS, ["C:AgentStats.xls"]

End Sub

It seems like I have to give the query an object name and reference that within the syntax but again I am now sure how to do that.

The error message I get is as follows

MS Access can't find the field "C:\AgentStats.xls" referred to in your expression.

Any Help would be great.

durdle
________
volcano digital vaporizer
 
Last edited:
DoCmd.OutputTo acOutputQuery, [TableNameHere], acFormatXLS, ["C:AgentStats.xls"]
 
hey crossmill,

DoCmd.OutputTo acOutputQuery, [working2], acFormatXLS, ["C:\AgentStats.xls"]
When you said [TableNameHere] did you mean [QueryNameHere] because I wanted to output a query?

durdle
________
vaporizer volcano
 
Last edited:
A snippet that i am currently using

DoCmd.OutputTo acOutputQuery, "qrySupplierRating", "MicrosoftExcel(*.xls)", , False

i use this and it worx for outputting to a spreadsheet.:D
 
hey daxton,

Thanks for the reply it works great.
One question, you know how it prompts you to save the file, is it possible to have that file to open automatically?

durdle
________
mexico city hotel
 
Last edited:
Maybe

I believe if you place the file path inside quotations in between the 2 commas. It will work.
 
Hey again,

One last one, You know when you get prompted to save the file, say if the user hits "Cancel" a window appears explaining if you want to "Debug" or "End". Just wondering how i can prevent the user from getting this screen.

Thanks

durdle
________
aero warriors
 
Last edited:

Users who are viewing this thread

Back
Top Bottom