Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2007, 09:16 AM
Authorized User
Points: 135, Level: 2
Points: 135, Level: 2 Points: 135, Level: 2 Points: 135, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Dallas, TX, .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Export to Excel Question

How would I export the results from an Access query to an Excel spreadsheet and at the same time open the spreadsheet to view the results by using a cmd button?

I've used this line of code to export information from a table to excel:

DoCmd.TransferSpreadsheet acExport, _
SpreadsheetTypeExcel9, "tblMain", _
"c:\bulk\Main.xls"

However, I have to manually find the excel file and open it to view the data.

Reply With Quote
  #2 (permalink)  
Old May 11th, 2007, 12:52 PM
Friend of Wrox
 
Join Date: Apr 2006
Location: Ternat, , Belgium.
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you know where the file will be put and what the name is, you just have to add some code after the one you already have to open the excell file...

So on the same action button you put the 2 codes one after the other...

You know how to do this?

Reply With Quote
  #3 (permalink)  
Old May 11th, 2007, 01:24 PM
Friend of Wrox
 
Join Date: May 2006
Location: Jonesboro, AR, USA.
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:
DoCmd.OutputTo acOutputQuery, "query name goes here", acFormatXLS, "path name goes here", -1

Reply With Quote
  #4 (permalink)  
Old May 11th, 2007, 03:09 PM
Authorized User
Points: 135, Level: 2
Points: 135, Level: 2 Points: 135, Level: 2 Points: 135, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2007
Location: Dallas, TX, .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

stealthdevil,

that line of code did it! thanks.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel ramuis78 ASP.NET 2.0 Basics 2 May 30th, 2007 05:51 AM
export to excel roy_mm Reporting Services 0 September 2nd, 2006 11:53 PM
excel export msrnivas .NET Web Services 1 June 10th, 2004 08:29 AM
excel export msrnivas Classic ASP Components 0 June 9th, 2004 10:15 PM
excel export msrnivas .NET Web Services 1 March 29th, 2004 03:21 PM



All times are GMT -4. The time now is 05:37 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.