• VB6 – Declaration (VB6)

    Author
    Topic
    #400852

    Hi,

    I have with this statement in VB6

    Dim dbTest As Database
    Dim rsWorker As Recordset
    Set rsWorker = dbTest.OpenRecordset(“worker”, dbOpenDynaset)

    When executing the form, it prompts “type mismatch”. Is there anything I missed? Thanks…

    chl88

    Viewing 1 reply thread
    Author
    Replies
    • #785013

      Do you have references set to both DAO and ADO, or to ADO alone? Both DAO and ADO have recordset objects, and without specific declaration (Dim rst As DAO.Recordset) the object will be interpreted as belonging to the first model in the references list. You also don’t indicate any code instantiating the database object, you just start trying to use it, which won’t work.

    • #785014

      Do you have references set to both DAO and ADO, or to ADO alone? Both DAO and ADO have recordset objects, and without specific declaration (Dim rst As DAO.Recordset) the object will be interpreted as belonging to the first model in the references list. You also don’t indicate any code instantiating the database object, you just start trying to use it, which won’t work.

    Viewing 1 reply thread
    Reply To: VB6 – Declaration (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: