error code 3265 Item cannot be found in the collection ... Why is this happening

Posted on 2006-03-28
Last Modified: 2008-01-09

Vb new boy has written a small application interfacing with a sqlserver database.

need to take data that has been added to database and output it as an xml file in order that it can be accessed by another application.

I was given the code below and told it should work - can't see why it shouldn't but then...

The application falls over at the oCmd.Properties("Output Stream") = oDom statement - error code 3265 Item cannot be found in the collection corresponding to the requested name or ordinal. I have no idea what this means.

Should the "Output Stream" statement read something other than "Output Stream"? If so, what?

Can anybody shed any light for me and tell me how to remedy the problem?

Thank you in advance

     'Instance of XML Parser
    Dim oCmd, sSQL, oDom

    ''' If MSXML 4.0 is not installed this will not work!
    Set oDom = CreateObject("Msxml2.DOMDocument.4.0")

    Set oCmd = CreateObject("ADODB.Command")
    oCmd.ActiveConnection = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=SCLAnodising;UID=GCroxford;Password=xxxxx"

    sSQL = "<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql"><sql:query>" & "select * from Build_Validation for xml auto</sql:query></ROOT>"

    oCmd.CommandText = sSQL

    oCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}"

    oCmd.Properties("Output Stream") = oDom
    oCmd.Execute , , 1024

    oDom.Save "C:\Documents and Settings\Desktop\testdts.xml"
Question by:ReneLMadsen
    1 Comment
    LVL 6

    Accepted Solution


    Usually this means that either the property "Properties" or "Output Stream" does not exist for the object you are using which in this case is the ADODB.Command object.

    A better way would be to use the intelliense so try the following...

    dim oCmd as new Adodb.Command

    then delete the statement where you Set oCmd = CreateObject....

    then within the editor, if you type oCmd.  you should then get a list of all the properties available (make sure you do the .) and you can check if Properties exists.

    Below is a link to microsoft KB to give a working example

    HTH :)


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now