Solved

Transferring access report to excel...

Posted on 2006-11-15
12
159 Views
Last Modified: 2013-11-28
I have an app that records a help desk-style log into an acess database (ado).

I created a report within Access to generate the output that I want.  Now, I'd like to blend that into my app.

Within access, I can simply open the report, go to Tools/Office Links/Analyze with Excel to accomplish this, but I want to do it from my code.

The reporting feature that I currently have is designed to loop through the recordset and drop the fields into Excel.
That works fine, but I need to duplicate that reporting from the Report that I've created in Access.  I need the easiest solution possible since this code is quite old and I'm trying to talk myself out of doing this anyway... ;)

Let me know if anything else is needed to get started.
Thanx.
0
Comment
Question by:sirbounty
[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
  • 7
  • 5
12 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17949296
Hi sirbounty,

Is this report and all its calculations based on a query?  If so, then the easiest thing to do is probably just to use
the TransferSpreadsheet method to export the query results to Excel.  That will work in just one line of code,
and it has the side benefit of making the Excel data more analysis-friendly than the report dump would be.

Regards,

Patrick
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17950041
Hi Patrick - I'm not familiar with that method, but it sounds intriguing. :^)

It looks as if the control source for the details' items are all field names from the main table...  I suppose that means it's not coming from a query?  I've really got next to zero experience with Reports in Access and find them a bit confusing, admittedly... : \
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17950139
sirbounty,

:)

Did you create the report using the wizard?  If so, what did you select as the source for the report?  BTW,
TransferSpreadsheet works for tables too, not just queries.

Regards,

Patrick
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 67

Author Comment

by:sirbounty
ID: 17950657
Probably so...I'm trying to remember how to check that...back in a moment.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17950683
Ah - it appears that it 'is' a query... :^)
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17981302
Still around matthewspatrick?
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17981975
Sorry, I'll try to check in after dinner :)
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17982122
No rush - just wanted to make sure you were getting the notifs...  :^)
I'm out after Wednesday anyway, so it's okay if we don't resolve it this week too...
0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 17987930
OK, here's the syntax, assuming you're running it from Access:


With DoCmd
    .SetWarnings False
    .TransferSpreadsheet TransferType:=acExport, TableName:="NameOfYourQuery", _
        FileName:="c:\folder\subfolder\filename.xls", HasFieldNames:=True
    .SetWarnings True
End With


Even thought the argument is called TableName, it works with both tables and queries.  If HasFieldNames
is true, then you get a header row; if false, no header.

Sorry for the long wait,

Patrick
0
 
LVL 67

Author Comment

by:sirbounty
ID: 17988022
Don't apologize...I'll take a look at this - hopefully before I head out...
Thanx again!
0
 
LVL 67

Author Comment

by:sirbounty
ID: 18155190
sorry for the delay -unexpected travel...

Not running it from access - need to run it from within VB.

Any idea?
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 18156210
Well, if it's an Access report, instantiate an Access.Application object, open that database,
and then do the With block above, just this time:

With AccessApp.DoCmd
...

Patrick
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
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 …
Suggested Courses

615 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