**CODE**
Private Sub Command2_Click()
Dim periodend As Date
Dim strperiod As String
Dim objFSO As Object
Dim objFile As Object
Dim strContents
Const ForReading = 1
Const ForWriting = 2
'Make temporary data table of time entry data
DoCmd.OpenQuery "Epip"
'User enters period end date, old file backed up with old period date in filename
periodend = CDate(InputBox("Enter Period End Date (mm/dd/yyyy)", "Pay Period")) - 14
'Reformat date for file naming purposes to yyymmdd format
strperiod = Format(Year(periodend), "0000") & Format(Month(periodend), "00") & Format(Day(periodend), "00")
'backup old data before overwrite
FileCopy "J:\apps\timesaver\impexp\gh6.csv", "J:\apps\timesaver\impexp\previous csv files\" & strperiod & "-gh6.csv"
'Export new data to csv file overwriting old file
DoCmd.TransferText acExportDelim, "GH6Export", "EpipTemp", "J:\apps\timesaver\impexp\gh6.csv", True
'Open generated csv file and replace "File ." with "File #" for loading into enterprise
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("J:\apps\timesaver\impexp\previous csv files\" & strperiod & "-gh6.csv", ForReading)
strContents = objFile.ReadAll
objFile.Close
Set objFile = objFSO.OpenTextFile("J:\apps\timesaver\impexp\previous csv files\" & strperiod & "-gh6.csv", ForWriting)
strContents = Replace(strContents, "File .", "File # ")
objFile.Close
End Sub