kengooch
Member
- Local time
- Today, 00:40
- Joined
- Feb 29, 2012
- Messages
- 137
I have been exporting reports to excel, but it brings over all the formating. Is it possible to just send the data that has been filtered in ascii text only to a excel workbook? Here is the code I am currently using. The Form from which the data comes is filtered by a series of 5 multi-select list boxes that builds a filter as items in the various unbound list boxes is select. The variable that stores this string is vIndvSel and that is passed to a variable vSetFilters the form automatically updates using the following code
Once the user has the filtered records they want they Click a button that Says "Export to Excel" that has the following code.
I really just want to export the underlying data. The form is based on the qStaff query from the tStaff table.
So hopefully there is a way to pass qStaff with the filter above so that it just gives me the raw data without all the report headers and formating etc.
Private Sub mslBox1_Click()
Me.Form.Filter = vSetFilters
Me.Form.FilterOn = True
Me.Form.Refresh
End Sub
Once the user has the filtered records they want they Click a button that Says "Export to Excel" that has the following code.
Private Sub bToExcel_Click()
'Export Custom Report to Excel
'- - - - - - - - - - - - - - -
'Show Popup
fProcessing.Caption = "Export Query to Excel"
fProcessing.vCurProcs = "Copying Staff Records to Excel"
fProcessing.Show vbModeless
fProcessing.Repaint
'Put your process code here
vDate = Format(Date, "yyyymmdd")
vPath = "S:\CITC\MS-Tools\Reports\"
vFileNm = vDate & " " & "Staff Custom Report.xlsx"
[B] DoCmd.OutputTo acOutputForm, "fStaffListMSLB", acFormatXLSX, vPath & vFileNm, True[/B]
'Close Popup
fProcessing.Hide
'- - - - - - - - - - - - - - -
End Sub
I really just want to export the underlying data. The form is based on the qStaff query from the tStaff table.
So hopefully there is a way to pass qStaff with the filter above so that it just gives me the raw data without all the report headers and formating etc.