Help Export VB code not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Below is the code I am attempting to use to create a query to export to excel
from 2 text boxes in a form

Dim StrPath As String
Dim StrWkPkg As String

StrWkPkg = ("qsel" & Forms![frmPjtReport]![txtWkPkg] & "" &
Forms![frmPjtReport]![txtSection])
StrPath = "C:\XWork\Output\" & txtFileName & ".xls"
DoCmd.CopyObject "ProcessPmtRpt.mdb", StrWkPkg, acQuery, "qselWkPkgCon"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, StrWkPkg,
StrPath, True
DoCmd.DeleteObject acQuery, SteWkPkg
 
Back
Top