TransferSpreadsheet Action - 2 Questions

gnarpeggio

Registered User.
Local time
Today, 05:05
Joined
Jun 22, 2010
Messages
74
Hello,

I've created a command button that evaluates a query and exports it to a spreadsheet. Now, I have two burning questions that I hope to get resolved in this post.

1) I've successfully satisfied the syntax for exporting the query results into a spreadsheet, but I'm trying to use a field name within the query to automatically name the spreadsheet file based on the section name.

Under the [FileName] argument, I'm trying to get the export to look something like "[SectionName].xls", but I'm not sure if that's the correct syntax for pulling the query result's field name. Any ideas?

2) Once the OnClick event executes, I'm trying to get the exported spreadsheet to automatically open Excel with the information presented within. Is there any way to do this? Currently, the spreadsheet will export directly to the My Documents folder by default but it won't open.

Any tips on these two would be greatly appreciated!
 
You don't know the name of the field at that point? You could open a recordset on the query, but you'd have to know the position of the desired field.

The simplest way to open the file is probably FollowHyperlink. You can also use Shell or:

http://www.mvps.org/access/api/api0018.htm
 

Users who are viewing this thread

Back
Top Bottom