Solved

Access 2007 - Exporting TAble Contents to Excel 2007 Spreadsheet

Posted on 2011-02-25
9
641 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
  • 4
  • 3
  • 2
9 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34983676
so, what is the problem?
0
 
LVL 119

Expert Comment

by:Rey Obrero
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
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 34983741
In other words, the correct extension is:
    .xlsx
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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 119

Expert Comment

by:Rey Obrero
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
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 …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now