?
Solved

Trying to export query data

Posted on 2013-06-11
6
Medium Priority
?
358 Views
Last Modified: 2013-06-11
I am trying to export the results of a query with:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryDistinctEmailAddresses", "C:\EmailAddressExport", True

but am getting a runtime error (see attachment)

Also, instead of exporting the Excel file to the user's C drive I want it to go to the user's desktop.
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 48

Expert Comment

by:Dale Fye
ID: 39237981
1. no attachment included.

2.  Try adding a file extension (.xlsx) to the output file name
0
 

Author Comment

by:SteveL13
ID: 39238077
Sorry... attachment here.
runtime-error.jpg
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39238134
You only have the path. A filename is needed too, like:

"C:\EmailAddressExport\MyExport.xlsx"

/gustav
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:SteveL13
ID: 39238359
Now I have this...

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "qryDistinctEmailAddresses", "C:\EmailExport\EmailAddresses.xlsx"

But when I try to open the Excel file I get the attached error.

??
error2.jpg
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 39238441
Seems like you don't have the correct version of Excel.
Try to create an older *.xls file with:

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "qryDistinctEmailAddresses", "C:\EmailExport\EmailAddresses.xls"

/gustav
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 39238521
if you are using A2003, use this

DoCmd.TransferSpreadsheet acExport, 8, "qryDistinctEmailAddresses", environ("userprofile") & "\Desktop\EmailAddresses.xls", True

if you are using A2007 or greater use this

DoCmd.TransferSpreadsheet acExport, 10, "qryDistinctEmailAddresses", environ("userprofile") & "\Desktop\EmailAddresses.xlsx", True
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question