?
Solved

Access 2007 - Exporting TAble Contents to Excel 2007 Spreadsheet

Posted on 2011-02-25
9
Medium Priority
?
661 Views
Last Modified: 2012-05-11
Hi All,

I have seen this question posed all over online and yet none of the answers that seems to work for others actually works for me!  What I am trying to do is EXPORT the contents of an Acees 2007 Table to an Excel 2007 spreadsheet in XSLX format.

I have tried:

DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xml, "JournalRequest", "H:\WBC\Projects-in-Progress\Trade Preparation Database Tool\JournalRequest.xslx", True

and

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "JournalRequest", "H:\WBC\Projects-in-Progress\Trade Preparation Database Tool\JournalRequest.xslx", True

As you can see my Table Name is "JournalRequest" and I have hard-coded the path to the Output File I want to create.

I CAN achieve outputting my data to other Text Files (CSV, TXT) formats using Export Specifications I create. BUT I *think* that there HAS to be a way to do what I'm attemption.  Help!
0
Comment
Question by:Tom_wbi
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34983676
so, what is the problem?
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34983707
do you mean, using a variable as the name of the .xlsx file?

dim strTable
strTable="JournalRequest"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, strTable, "H:\WBC\Projects-in-Progress\Trade Preparation Database Tool\" & strTable & ".xslx", True
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983733
You spelled the extension wrong

.xlsx
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 34983741
In other words, the correct extension is:
    .xlsx
0
 

Author Comment

by:Tom_wbi
ID: 34983766
Hi All - No I mean it does not work.

For example, using:
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, "JournalRequest", "H:\WBC\Projects-in-Progress\Trade Preparation Database Tool\JournalRequest.xslx", True

Generates Run-time Error 3027. 'Cannot Update. Database or object is read-only'

When I modify the command as such:

DoCmd.TransferText acExport, acSpreadsheetTypeExcel12Xml, "JournalRequest", "H:\WBC\Projects-in-Progress\Trade Preparation Database Tool\JournalRequest.xslx", True

The error becomes: 'You cannot import this file' even though I'm trying to do an EXPORT.

So, I must have some syntax wrong with my command - perhaps a bad constant??

Sorry I wasn't more clear, initially.


0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34983784
the .xslx is wrong (.xlsx) as pointed out by jeff, unless it is just a typo error
0
 

Author Closing Comment

by:Tom_wbi
ID: 34983807
OMG!!!

I am partially dyslexic and could NOT see that I was transposing the 'l' and 's'.  Thank you so much for taking the time to notice this!!!!!!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983826
1. First you are never stating what actually happens when it "Does not work"
Nothing happens?
Wrong output format?
Access Crashes?
Error message?

You will get some type of read only error, and the Export will "Not Work" when you spell the extension incorrectly as you have done in the code you posted.

Please correct this misspelling and tell us if that fixes this issue.

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34983838
Thanks...

It is a common mistake.

;-)

Jeff
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

741 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