title: How can I handle errors when copying file over Network
body: <p>I'm recycling code from an old database.</p>
  
  <p>For one person, located half way across the country, I believe there may be some connection issue.</p>
  
  <pre><code>Public Function BackUpBackend()
  
      Dim Source As String
      Dim Target As String
      Dim retval As Integer
  
      Source = "\\network\backend\accessfile.accdb"
  
      Target = "\\network\backend\backup\"
      Target = Target &amp; Format(Date, "mm-dd") &amp; "@"
      Target = Target &amp; Format(Time, "hh-mm") &amp; ".accdb"
  
      retval = 0
      Dim objFSO As Object
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      retval = objFSO.CopyFile(Source, Target, True)
      Set objFSO = Nothing
  
  End Function
  </code></pre>
  
  <p>Is there any way to detect connection errors in this code? And if there is, can the connection be re-established or just stop the backup process all together when the issue comes up?</p>