var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
I am having a report that starts on a new page for each customer ID. I group by customer ID. So, basically, the records contains customer ID and product ID. For example,
B 001 etc
So the report shows :
Customer ID : A
So, now, I want to transfer my database to excel.
So, the excel file will have as many as customers I have. For example,
First sheet will only have customer A information, second sheet will only have customer B infomation and so on.
Does anyone know how to do this ? Thanks
If you have already created the report in access, it is quite simple to export it to excel.
use the following command:
Docmd.OutputTo(ObjectType, ObjectName, OutputFormat, OutputFile, AutoStart, TemplateFile, Encoding)
Private Sub PrintExcel(ReportName As String)
Dim rstParameters As New ADODB.Recordset
Dim strPath As String
strSQL = "SELECT P_Value FROM T_Parameter WHERE P_ID = 'PATH EXCEL REPORTS'"
rstPara.Open strSQL, CurrentProject.Connection
strPath = rstParameters.Fields(0)
DoCmd.OutputTo acOutputReport, ReportName, acFormatXLS, _
strPath & "ListOfContacts.xls", True
DoCmd.Close acForm, "frmOpen"
msgbox "Error in PrintExcel" & err.Description
Hope it helps!!!
I used the DoCmd.OutputTo in macro, but funny things happened. If I use existing excel file, then my excel file suddenly gone from my drive after the macro finishes. When I use a new excel file, it does not appear. Do you know why ?
try setting Autostart to True
See what happens
Normally the file should open after the macro
In my experince this works just fine. I do not use the macro however but I put this in vba code.
Last edited by annavp; 04-24-02 at