Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Access 2007 - Exporting TAble Contents to Excel 2007 Spreadsheet

Posted on 2011-02-25
9
Medium Priority
?
662 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

609 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