CREATING A RECORDSET WITH ADO
Now it's time to see how to use ADO to perform one of the most common tasks—opening recordsets.
Opening a Simple Recordset
To open a recordset, you will first create a connection object off the current project, and then specify a new ADO recordset object:
Sub OpenRecordsetWithGetStringDisplayExample() Dim cnnLocal As New ADODB.Connection Dim rstCurr As New ADODB.Recordset Set cnnLocal = CurrentProject.Connection rstCurr.Open "Select * from tblMovieTitles where ReleaseDate _ = #02/01/99#", cnnLocal, _ adOpenStatic, adOpenPessimistic Debug.Print rstCurr.GetString rstCurr.Close End Sub
Although this code is very similar to DAO, in ADO you use the Recordset object's Open method rather than an OpenRecordset method. ...
Get F. Scott Barker's Microsoft® Access 2000 Power Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.