Save As from Access

K

Kevin

I'm trying to export a query to an Excel file, in a location that the user
can choose.

I know the FileDialog command does not support Save As, and I would like to
steer away from API calls if at all possible.

Do I have any other options? If not, could someone please explain where I
put the Function for the API call?

Thanks in advance!
Kevin
 
D

Dirk Goldgar

Kevin said:
I'm trying to export a query to an Excel file, in a location that the
user can choose.

I know the FileDialog command does not support Save As, and I would
like to steer away from API calls if at all possible.

Do I have any other options? If not, could someone please explain
where I put the Function for the API call?

Thanks in advance!
Kevin

I think calling the Windows API is actually your best bet -- either the
File Open/Save dialog or the Browse for Folder dialog, whichever is
appropriate. See the code and examples on these pages:

www.mvps.org/access/api/api0001.htm
www.mvps.org/access/api/api0002.htm
 
K

Kevin

Dirk,

Thanks for the response- I was afraid that was the answer! I've seen the
link to this page in other responses, but I'm confused as to where to paste
this code. Do I just copy everything in the blue box into the code behind my
button? What about the syntax at the top?

Thanks again,
Kevin
 
D

Dirk Goldgar

Kevin said:
Dirk,

Thanks for the response- I was afraid that was the answer! I've seen
the link to this page in other responses, but I'm confused as to
where to paste this code. Do I just copy everything in the blue box
into the code behind my button? What about the syntax at the top?

Copy everything from the "*** Code Start ***" line to the "*** Code End
***" line and paste it into a new standard module. If you're using the
File Open/Save code (api0001.htm), save that module as "basFileOpenSave"
(or any other name that seems suitable to you -- just don't use the same
name as anything else, or any of the procedures in the module itself).
If you're using the Browse Folder code (api0002.htm), I suggest you name
the module "basBrowseFolder".

The code behind your button will be modeled on the example code at the
top of the page (not in the module itself), which calls the code
procedures that are defined in the module you created.
 
K

Kevin

Thanks, Dirk,

I greatly appreciate the help! I've done a lot of coding, but never gotten
into calling procudures, so this helps.

Thanks and have a great New Year!
-Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top