Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload file with ADODB for Web-DAV "cannot find any objects or data in accordance with the name..."

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 = "[email protected]"
    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
like image 344
user1922341 Avatar asked Dec 21 '12 20:12

user1922341


1 Answers

This post suggests you "compare the versions of MDAC local and remote". I realize I am offering a minimal, inexpert answer, but since there are not others, here it is.

like image 50
Smandoli Avatar answered Oct 20 '22 01:10

Smandoli