Dim strPathFile As String, strFile As String, strPath As String, strTodaysFile As String
Dim strTable As String
Dim blnHasFieldNames As Boolean
' Change this next line to True if the first row in EXCEL worksheet
' has field names
blnHasFieldNames = True
'strPath = "S:\dailyETEreports\EndToEndTrackingSheet_"
'sFileDate = Format(Now() - 1, "yyyymmdd")
strPath = "S:\dailyETEreports\"
strTodaysFile = "EndToEndTrackingSheet_" & Format(Now() - 4, "yyyymmdd") & "_*.xls"
If Dir(strPath & strTodaysFile) = "" Then
MsgBox "No File present for today"
Else: strTodaysFile = Dir(strPath & strTodaysFile)
End If
strTable = "Order Tracking"
'strFile = sFileDate & "_*" & ".xls"
strPathFile = strPath & strTodaysFile
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _
strTable, strPathFile, blnHasFieldNames