Solved

Transferring MS Access data to MS Excel

Posted on 2010-08-31
9
1,138 Views
Last Modified: 2012-06-21
What is the difference between the three below options when transferring a Microsoft Access 2007 data source to MS Excel 2007?  Also, which do you prefer and why?
1.       acSpreadsheetTypeExcel12Xml
2.      acSpreadsheetTypeExcel9
3.      acFormatXLSX
0
Comment
Question by:CFMI
[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
9 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33568351
1 and 2 for use with docmd.transferspreadsheet

1. create in current version. have not found any main difference between this and acSpreadsheetTypeExcel12
2. create in older version of office 2000
3. not to be used with docmd.transferspreadsheet, probably more to do with docmd.outputto and is current version
0
 
LVL 9

Expert Comment

by:hitsdoshi1
ID: 33568367
Use
DoCmd.TransferSpreadsheet acExport, 10, etc.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33568386
I initially thought acSpreadsheetTypeExcel12Xml would create it in xml format, perhaps it can be used as part of importing but exporting does not seem to make a difference. Probably better to use acSpreadsheetTypeExcel12 though or not bother specifying (it is optional).
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 65

Expert Comment

by:rockiroads
ID: 33568423
back to the question which do I prefer? I don't have a preference. I never specify it unless I know I will be working with a particular version of office (like handling older versions).

with regards to what command to use? well I use both and use the tool which I feel is right for the job.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 33568432
see this link

http://msdn.microsoft.com/en-us/library/bb225982%28office.12%29.aspx
scroll down to the  bottom of page
0
 
LVL 1

Author Comment

by:CFMI
ID: 33568535
Gotcha on the versioning issue (eg., acSpreadsheetTypeExcel7,8,9, etc.).  Thank you.  So now I'm seeing three comparable methods:
•      DoCmd.TransferSpreadsheet acExport, 10, "MyQueryName", "C:\MYxlsxFileName. xlsx ", True
•      DoCmd.TransferSpreadsheet acExport, [acSpreadsheetTypeExcel12Xml] or [acSpreadsheetTypeExcel12], "MyQueryName", "C:\MYxlsxFileName. xlsx ", True
•      DoCmd.OutputTo acOutputQuery, "MyQueryName", acFormatXLSX, "C:\MYxlsxFileName.xlsx", True

Any notable differences here?
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 500 total points
ID: 33571353
I don't recommend using hardcoded numbers, use the predefined constants instead.

Main difference between the two, you can specify ranges in transferspreadsheet so you can append worksheets
outputto is one straight write so would overwrite anything previously created

This command

DoCmd.TransferSpreadsheet acExport, , "MyQueryName", "C:\MYxlsxFileName. xlsx ", True

would work just as well because then I believe it would use whatever version you have.

that 2nd parameter is a enumeration type called AcSpreadSheetType. Type that in followed by . should bring up the list of constants available.

0
 
LVL 1

Author Closing Comment

by:CFMI
ID: 33575480
Thank you!
0
 
LVL 1

Author Comment

by:CFMI
ID: 33576961
It's interesting that 2nd parameter - enumeration type AcSpreadSheetType - typed in and followed by . brings up "a list of constants available" (including acSpreadsheetTypeExcel7,8,9) but NOT "10, 11, or 12."  I don't know if that's dependent on the active reference library but glad to get the good info from you!  Thx again.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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 …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

726 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