Solved

Access 2007 - Exporting TAble Contents to Excel 2007 Spreadsheet

Posted on 2011-02-25
9
647 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 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
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 “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

803 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