Just noticed a small issue and I can't seem to figure it out.
Hopefully this will be the last (at least for this script.
Once I changed it over to FSO, the network drives works but now my
"retval" line ...
retval = FSO.CopyFile(Source:=strhyplink,
Destination:="\\192.168.0.51\Route\" & Mid(strhyplink, strFileName +
1))
stays at "zero" and always throws up the message box... here is my
code in full (I changed some stuff....
_______________________________________________________________________
Private Sub cboUpdate_Click()
Dim FSO As Object
Dim strhyplink As String
Dim retval As Long
Dim strFileName As String
Set FSO = CreateObject("Scripting.FileSystemobject")
'set strhyplink value as the forms text box.
strhyplink = Forms!frmGuides!txtSource
'get the file name only, start to the right and go until the
backslash
strFileName = InStrRev(strhyplink, "\")
If strFileName > 0 Then
'msgbox to show the right file name,
MsgBox Mid(strhyplink, strFileName + 1)
End If
'set the file Dest
retval = FSO.CopyFile(Source:=strhyplink,
Destination:="\\192.168.0.51\Route\" & Mid(strhyplink, strFileName +
1))
Debug.Print strhyplink
Debug.Print Mid(strhyplink, strFileName + 1)
If retval = 0 Then ' failure
MsgBox "Import Failed!!!" & vbNewLine & vbNewLine & _
"File Name: '" & Mid(strhyplink, strFileName + 1) & "'"
& vbNewLine & vbNewLine & _
"Reason: File already exist!", vbCritical, "UPS DMS"
Else ' success
MsgBox "Import of '" & Mid(strhyplink, strFileName + 1) & "'
succeeded."
Me.txtDest = strFileName
End If
'release memory
Set FSO = Nothing
End Sub
________________________________________________________________
Thanks
Dave
You are correct Dave... FSO worked like a charm!!! Thanks for all your
help!