Yes, I know how to do that but I need to display the query with a toolbar
that allows exporting to excel.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
"fredg" wrote:
> On Mon, 11 Jan 2010 10:19:01 -0800, Dorian wrote:
>
> > I need to run a query and allow the user to export the results to excel.
> > Is there any way to have a custom toolbar display when the query is opened
> > and disappear when it is closed, much like what you can do with a report via
> > its Toolbar property?
> > Thanks.
> > -- Dorian
> > "Give someone a fish and they eat for a day; teach someone to fish and they
> > eat for a lifetime".
>
> I don't think so in a query.
>
> But, why do you need to actually open the query before exporting it to
> Excel?
> You can use the TransferSpreadsheet method to export the query data
> without opening the query or Excel:
>
> DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
> "MyQueryName", "C:\PathToFolder\MySpreadsheetName.xls",True
>
> Look up the arguments in VBA help.
> --
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
> .
>
|