Retrieving a Set of Records

The ability to retrieve the records stored in a database file is essential. The following example illustrates how to retrieve all the records from a table called Layers, and displays each record in a typical MsgBox:

'retrieve records from the Layers table Dim oRecordset As New ADODB.Recordset oRecordset.Open "Select * From Layers", oAccess, adOpenKeyset

With oRecordset Do While Not .EOF MsgBox !LayerName & ", Color is " & !color .MoveNext Loop .Close End With

0 0

Post a comment