Solved

How to pass records from MS Access to an MS Excel template

Posted on 2014-12-10
4
160 Views
Last Modified: 2014-12-14
I am familiar with how to establish a MS Excel session within MS Access and manipulate records within MS Excel from MS Access  However, if I need to take a 1000 records from an MS Acccess table (75 columns) and put that information into an MS Excel template file what is the most efficient way of accomplishing this task.  Any links or example would be great.

I assume I would want to loop thru my table and work on a record at a time keeping track of what row I am on within MS Excel...

Note I can not do a docmd since the purpose of the MS Excel template is to avoid any formatting I may need to do once the data is within MS Excel.  However, I am wondering if I am better off doing a docmd and getting the data out into the workbook and then attempting the formatting from within MS Access
0
Comment
Question by:upobDaPlaya
  • 2
4 Comments
 
LVL 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
Comment Utility
Hi,

Instead of DoCmd you could Use within Excel CopyRecordSet

http://msdn.microsoft.com/en-us/library/office/ff839240(v=office.15).aspx

Regards
0
 
LVL 119

Expert Comment

by:Rey Obrero
Comment Utility
is "MS Excel template" really a template (.xlt, .xltx)  or just a preformatted Excel workbook?
0
 

Author Comment

by:upobDaPlaya
Comment Utility
I have attached a sample of what I am trying to do.  I have an MS Access DB that has 2 tables.  Each table will be placed in its own MS Excel worksheet, but the same workbook.  Note the Excel workbook has formatting in addition to formulas I need to display (row 11 Profile worksheet and row 6 Hours worksheet).

The Hours tab is somewhat standard in I assume I will write the data from the MS Access Hours table to the Hours worksheet, although I am struggling with how I would display the formulas.  In addition the Hours tab currently has 6 rows, but the amount of row I will try to write from the MS Access Hours table will not always be 6 rows.

The Profile tab is a little trickier since some cells are only populated once and it is not a 1 to 1 drop from the MS Access table.

Lastly I am creating a workbook for each Profile ID.  I am looping thru to get each Profile ID so that is not an issue.
eeExcel.xlsx
eeMSAccess.accdb
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 300 total points
Comment Utility
place this in the same folder as your excel file, then run Export2XL in module 1
eeMSAccess.accdb
0

Featured Post

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)

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

744 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

8 Experts available now in Live!

Get 1:1 Help Now