Solved

Transferring MS Access data to MS Excel

Posted on 2010-08-31
9
1,100 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
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
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.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

785 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