How to export just the Detail part of a form and not the header?

noaccessidea

New member
Local time
Today, 20:50
Joined
Nov 29, 2019
Messages
14
I have a form which has a few combo boxes at the top and then a subform which gets filtered by the combo boxes. I need to frequently apply a filter and export the results to excel so I have created a button to export to excel, which have discovered can be done in a number of ways, but every way I have found creates columns in the spreadsheet for the combo boxes as well as the subform.

Is there a (hopefully simple) way to export just the subform's filtered results?
 
i would hope the combo box has 2 columns: caption , Qry
where the query is the 'filter' to apply to the subform.sourceobject.

so just export the combo value:
vFile = "c:\temp\file.xls"
sSheet = cboBox.column(0)
docmd.TransferSpreadsheet acExport ,acSpreadsheetTypeExcel9 ,cboBox, vFile,true, sSheet
 
i would hope the combo box has 2 columns: caption , Qry
where the query is the 'filter' to apply to the subform.sourceobject.

so just export the combo value:
vFile = "c:\temp\file.xls"
sSheet = cboBox.column(0)
docmd.TransferSpreadsheet acExport ,acSpreadsheetTypeExcel9 ,cboBox, vFile,true, sSheet
Sorry, I think I didn't explain clearly. I don't want the combo boxes to show as columns and they have ugly names and are duplicating values already included in the subform fields. In the attached image I just want the columns from CourseName onwards, the first 3 shouldn't be there.
 

Attachments

  • Capture.PNG
    Capture.PNG
    8.2 KB · Views: 99
set the column widths to zero.
columnwidth property : 1;0;0;0

shows 1st col as 1 inch
the rest are hidden.
 
set the column widths to zero.
columnwidth property : 1;0;0;0

shows 1st col as 1 inch
the rest are hidden.
Where do I set that, on the combo boxes? I am already using the width setting on the combo boxes.

This is the form I am using, I don't want the header contents to be exported, just the detail. I noticed that I can set the header and contents to be Screen Only in the Display When setting but this doesn't work when using the OutputToExcel command in a macro.

Capture.PNG
 

Users who are viewing this thread

Back
Top Bottom