I have an MS Access 2007 VBA application running on Windows 7. One crucial function is to upload files to a WebDAV server. The code below works perfectly on one PC, but fails on other PCs (and yes, each is configured the same way).
Here is a translate.google.com translation of the Norwegion error message that pops up when it fails on the other PCs:
Run-time error '-2147217895 (80040e19)': can not find any objects or data in accordance with the name, range or selection criteria within the scope of this operation
It fails on this line of code:
objRecord.Open fil, "URL=" & URL, adModeReadWrite, adCreateOverwrite, adDelayFetchStream, sUsername, sPwd
The full function code is below. It's really just reuse of the code at http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/26b8e905-33d0-438b-98a7-bb69053b931e/. Any hints would be greatly appreciated!
Function DAVPUT(ByVal URL As String, ByVal fil As String) As Boolean '
Dim sUsername As String
Dim sPwd As String
sUsername = "k@dummy.com"
sPwd = "dummy"
Dim objRecord As New ADODB.Record
Dim objStream As New ADODB.Stream
objRecord.Open fil, "URL=" & URL, adModeReadWrite, adCreateOverwrite, adDelayFetchStream, sUsername, sPwd
objStream.Type = adTypeBinary
objStream.Open objRecord, adModeWrite, adOpenStreamFromRecord
objStream.LoadFromFile fil
objStream.Flush
DoEvents
objStream.close
objRecord.close
DAVPUT = True
End Function