I have the following function that works. Could i rationalize it further,make it more simple or
avoid repetition of the commands?
Option Compare Database
Option Explicit
Public StrSource As String
Public Const strDest = bappath
Public Function CopyBackDepots()
DepotBl
DepotVa
DepotHa
DepotPl
DepotTa
DepotTr
DepotSz
DepotRs
DepotBs
DepotSo
End Function
Public Function DepotBl()
On Error Resume Next
StrSource = DBl
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotVa()
On Error Resume Next
StrSource = DVa
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotHa()
On Error Resume Next
StrSource = DHa
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotPl()
On Error Resume Next
StrSource = DPl
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotTa()
On Error Resume Next
StrSource = DTa
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotTr()
On Error Resume Next
StrSource = DTr
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotSz()
On Error Resume Next
StrSource = DSz
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotRs()
On Error Resume Next
StrSource = DRs
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotBs()
On Error Resume Next
StrSource = dbs
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
Public Function DepotSo()
On Error Resume Next
StrSource = DSo
If Dir(StrSource, vbNormal) <> "" Then
Kill (StrSource)
End If
FileCopy StrSource, StrSource
End Function
note bappath, depotBl etc are paths