Hi All.
I have a frontend / backend globally used database that, at startup, downloads 2 files from a sharepoint. We have been using it for the last 4 years... Today, 1 file won't download and the other will - answer returned = 0 (No error) I had other users run the database and both files downloaded properly.
For both downloads, it uses URLDownloadToFile:
this one does download..
Code:
Public Function Copy_Heat_Map_Templet_From_Sharepoint()
Dim answer As Variant
Dim dir_exists As Boolean
dir_exists = False
Status_Message_Open True, "Downloading Heat Map Template from Sharepoint..."
DoEvents
'make directory if it does not exist
On Error Resume Next
MkDir LZ_LOCAL_PATH
If Err Then ' err = 75 folder already exists
answer = answer
Err.Clear
End If
'delete file if it exists
On Error Resume Next
Kill LZ_LOCAL_PATH & HEAT_MAP_TEMPLET_FILENAME
On Error GoTo 0 ' error 53 = file not found
Err.Clear
answer = URLDownloadToFile(0, HEAT_MAP_SHAREPOINT_PATH & HEAT_MAP_TEMPLET_FILENAME, LZ_LOCAL_PATH & HEAT_MAP_TEMPLET_FILENAME, 0, 0)
If answer <> 0 Then
If answer = -2147467260 Then
MsgBox "Heat Map Templet currently open. Newest version not downloaded..."
Else
MsgBox "Error Downloading Heat Map Templet from Sharepoint..", vbCritical
End If
End If
Status_Message_Open False
End Function
2nd function does not download anymore... they are identical
Code:
Public Function Copy_LZ_Templet_From_Sharepoint()
Dim answer As Variant
Dim dir_exists As Boolean
dir_exists = False
Status_Message_Open True, "Downloading LZ Template from Sharepoint..."
DoEvents
'make directory if it does not exist
On Error Resume Next
MkDir LZ_LOCAL_PATH
If Err Then ' err = 75 folder already exists
answer = answer
Err.Clear
End If
'delete file if it exists
On Error Resume Next
Kill LZ_LOCAL_PATH & LZ_TEMPLET_FILENAME
On Error GoTo 0 ' error 53 = file not found
Err.Clear
answer = URLDownloadToFile(0, LZ_SHAREPOINT_PATH & LZ_TEMPLET_FILENAME, LZ_LOCAL_PATH & LZ_TEMPLET_FILENAME, 0, 0)
If answer <> 0 Then
MsgBox "Error Downloading LZ Templet from Sharepoint..", vbCritical
End If
Status_Message_Open False
End Function
Thanks.
Steve