Results 1 to 4 of 4

Thread: Set Variable = query Result

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    95

    Question Set Variable = query Result

    I want to set a variable to equal the result from a database query.
    ex:
    VB Code:
    1. selectSQL = "SELECT FirstName, LastName FROM Client;"
    2. qResults = ConSource.Execute selectSQL

    That should give you an idea of what im trying to do, Is this even possible?

    Thanks,
    Ryan

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Set Variable = query Result

    Dim qResults as Recordset

    set qResults = ConSource.openrecordset(selectSQL)

    I think thats it (that may be for DAO though and not ADO...my ADO is rusty)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    95

    Re: Set Variable = query Result

    Quote Originally Posted by [LGS]Static
    Dim qResults as Recordset

    set qResults = ConSource.openrecordset(selectSQL)

    I think thats it (that may be for DAO though and not ADO...my ADO is rusty)
    Thanks for the quick reply,
    But i forgot to mention i am using a DSN Connection.


    Ryan

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 2004
    Location
    Canada
    Posts
    95

    Re: Set Variable = query Result

    I tried this
    VB Code:
    1. Dim Query As rdoResultsets
    2.  
    3. SQL = "SELECT FirstName, LastName FROM client;"
    4. Set Query = conSource.rdoResultsets(SQL)

    But that doesnt seem to work either.

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