VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A easy way to get data from MSAccess parameter query into ADO Recordset

by Yuening Dai (30 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 12th March 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

A easy way to get data from MSAccess parameter query into ADO Recordset

Rate A easy way to get data from MSAccess parameter query into ADO Recordset



    '
    'Set reference to ADO library first.
    'In my test, the parameter query will return all records in table PRODUCTS
    'whoes ProductID <= the passed value. It looks like this:
    'SELECT Products.* FROM Products WHERE (Products.ProductID<=IDMax);
    '
    Dim Cnn As New ADODB.Connection
    Dim Rst As New ADODB.Recordset
    '
    'Open a Connection using an ODBC DSN.
    Cnn.Open "DSN=adoobj;UID=;PWD=;"
    '
    'All records whose ProductID <= 3 will be returned.
    Set Rst = Cnn.Execute("qry_storedproc 3", , adCmdStoredProc)
    '
    Do While Not Rst.EOF
        Debug.Print Rst(0)
        Rst.MoveNext
    Loop
    '
    Set Rstc = Nothing
    Set Cnn = Nothing
    '
End Sub


Download this snippet    Add to My Saved Code

A easy way to get data from MSAccess parameter query into ADO Recordset Comments

No comments have been posted about A easy way to get data from MSAccess parameter query into ADO Recordset. Why not be the first to post a comment about A easy way to get data from MSAccess parameter query into ADO Recordset.

Post your comment

Subject:
Message:
0/1000 characters