Good day developers. I want to ask about how to export filtered table to Ms.Excel 2007. so this vba code to filtered the table :
if i use DoCmd.OutputTo function, its export the whole table to excel. how can i filter this table ? thanks. Environment : Ms.Access 2010
Code:
Dim db As Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim flnm As String
Dim appXl As Excel.Application
Dim bookXl As Excel.Workbook
Const wrksheetName As String = "Welder Performance Overall"
On Error Resume Next
Set db = CurrentDb()
strSQL = "SELECT * FROM weld_performance WHERE welder_ident = '" & Me.Combo26.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenSnapshot, dbSeeChanges)
flnm = "G:\PROJECT\8382 - BCJV\017 - Quality Control Records\017.20 - Quality Control Records\017.20.25 Welders Weekly Performance Record\Welder Records - Piping\Welder Performance Overall\Excel Format\" & Me.Combo26.Value & " " & Format(Now(), "dd-MMM-yyyy")
Set appXl = CreateObject("Excel.Application")
appXl.Visible = False
Set bookXl = appXl.Workbooks.Open(flnm)
DoCmd.OutputTo acOutputTable, "weld_performance", acFormatXLS, flnm & "Welder Performance Overall " & Format(Now(), "dd-MMM-yyyy") & ".xls", True
'DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "", flnm, True
bookXl.Close
appXl.Quit
rst.Close
Set db = Nothing
Set rst = Nothing
Set appXl = Nothing
if i use DoCmd.OutputTo function, its export the whole table to excel. how can i filter this table ? thanks. Environment : Ms.Access 2010