Automated query in a text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am a new user. As a first challenge I had, I wanted to perform an automated task. I wanted to open a parameter query automatically and have the results in excel.

I got helped by BILL who suggested me to do the following:
create the excel file on drive c:
DoCmd.TransferSpreadsheet acExport, 8, "myQuery", _
"C:\my documents\MyExcelFile.xls", False

I tried this and it worked fine.

My new challenge is to apply this to a text box on a form, where I can select the query and by a click on a command button I get the results automatically in the excel file. I am kind of confuse on how to relate the click selection to the name of the query.
Can you please help me with this?

Thanks
 
It might be easier to link in the Excel spreadsheet and then create
parameter queries against the linked Excel spreadsheet.
Take a look at Files | Get External Data | Link. Once linked you can create
a form that contains your command buttons that will execute whatever the
query prompts for.
Example you have a field called Region. You want to prompt the user for
whatever region. Under the criteria section you type: Like [Enter Region or
Enter] & "*". What this statement does is allow the user to type in a
portion of the Region, such as Sou for South, Southern etc. or press enter
and get all the regions.

--
G Vaught

Dubois said:
Hi,
I am a new user. As a first challenge I had, I wanted to perform an
automated task. I wanted to open a parameter query automatically and have
the results in excel.
I got helped by BILL who suggested me to do the following:
create the excel file on drive c:
DoCmd.TransferSpreadsheet acExport, 8, "myQuery", _
"C:\my documents\MyExcelFile.xls", False

I tried this and it worked fine.

My new challenge is to apply this to a text box on a form, where I can
select the query and by a click on a command button I get the results
automatically in the excel file. I am kind of confuse on how to relate the
click selection to the name of the query.
 
Back
Top