Modifying TransferSpreadsheet cmd

J

Junior

Hi - i want to add a variable to the following DoCmd so that the xls file
name will contain strSta
Example: if strSta = "900" then the xls file name should be
C:\Data\900StaData.xls
Thanks

Dim strSta As String
strSta = Nz(DMin("StaNum", "tblStaData"), "ZZ")
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "tblOrg",
"C:\Data\StaData.xls", True, "Org"
 
M

MacDermott

Replace
"C:\Data\StaData.xls",
with
"C:\Data\" & strSta & "StaData.xls",

HTH
- Turtle
 
Top