I have a VBA application for MS Access 2007 running on Windows 7. One of the important functions is uploading files to the WebDAV server. The code below works fine on one PC, but doesnβt work on other PCs (and yes, each one is configured the same way).
The following is a translation of the translation of the Norwegian error message that appears when it does not work on 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
The error in this line of code is:
objRecord.Open fil, "URL=" & URL, adModeReadWrite, adCreateOverwrite, adDelayFetchStream, sUsername, sPwd
The full function code is given below. This is really just a reuse of the http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/26b8e905-33d0-438b-98a7-bb69053b931e/ code. 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
source share