Results 1 to 3 of 3

Thread: ADO Error

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Question

    Greetings,

    I have a Problem that is really nagging me. I have a VB app that is trying to get data in an Access 2000 .mdb

    here is a code snippet
    Code:
      
        adoDriver = "Driver={Microsoft Access Driver (*.mdb)};"
        adoPath = "dbq=" & DataBaseLocation & ";"
        adouser = ";"
        adoPassword = ""
    
        Dim rs As ADODB.Recordset
        
        ' used temporarily until code is working   
        strConnection = adoDriver & adoPath & adouser & adoPassword
        
        On Error GoTo handleErr
            dbCheckOut.ConnectionString = strConnection
            dbCheckOut.Open
            cmCheckOut.ActiveConnection = dbCheckOut
            cmCheckOut.CommandText = "select * from Machine"
            rs = cmCheckOut.Execute
        On Error GoTo 0
    dbCheckout is the connection object
    and cmCheckout is the command object

    Both are declared public


    The Problem is that the rs = mcCheckout.execute is saying invalid use of property and I have not clue as to why. I have looked in Technet and even downloaded a sample app from MS. And the sample code was "identical". And the references were nearly identical. Anyone have a clue as to why?

    Thanks much
    -=D=-

  2. #2
    Addicted Member ShIzO's Avatar
    Join Date
    Apr 1999
    Location
    Bartlett, IL
    Posts
    189

    Arrow

    what version of MDAC are u using?

    if you've got 2.1 then you need to use 2.5 i guess because you're running Access 2000.
    let me know if that works.
    www.HardFind.com -buy/sell/trade your used hardware.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50
    MDAC is not the problem... I don't recall what version i have, but I downloaded it of off MS about a month ago. So it is current.

    Here is what the problem was, I'm Dumb :-)

    The way that it needed to be done was this. I declared the database and connection object public. But that just make object set, It doesen't set it to anything.

    In the Form, I needed to do this
    Code:
    public DBCheckout as adodb.connection
    public CNCheckout as adodb.command
    
    sub getdata
    
         set dbCheckout = new adodb.connection
         set cnCheckout = new adodb.command
    
    end sub
    So what it ammounts to is that I forgot the 'new' keyword. So Like I said, I'm Dumb :-)

    Anyway, It works perfectly now

    Thanks for Replying
    -=D=-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width