by Yuening Dai (30 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 21st July 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Concise code to populate ADO recordset from MSAccess query with multiple parameters
'In my test, the parameter query in MSAccess looks like this (for testing purpose only):
'SELECT Titles.Title, Titles.[Year Published], Titles.PubID, Publishers.Name, 'Publishers.State
'FROM Publishers INNER JOIN Titles ON Publishers.PubID = Titles.PubID
'WHERE (((Titles.[Year Published])>=[SatartDate] And (Titles.[Year 'Published])<=[EndDate])
'AND ((Publishers.State)=[StateParam]) AND '((Publishers.PubID)<=[PubIDParam]));
'
'
Dim Cnn As New ADODB.Connection
Dim Rst As New ADODB.Recordset
'
'Open a Connection using an ODBC DSN. You can not use Jet OLEDB Provider here.
Cnn.Open "DSN=adoobj;UID=;PWD=;"
'
Set Rst = Cnn.Execute("Qry_MultiPrm #1/1/98#, #12/12/00#, 'MA', 8", , mdStoredProc)
'
Do While Not Rst.EOF
Debug.Print Rst(0)
Rst.MoveNext
Loop
Set Rst = Nothing
Set Cnn = Nothing
'
No comments have been posted about Concise code to populate ADO recordset from MSAccess query with multiple parameters. Why not be the first to post a comment about Concise code to populate ADO recordset from MSAccess query with multiple parameters.