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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top