VB5Create the ADOCE Recordset
Sub LoadRecords()
   Dim sql
   On Error Resume Next
   Set rs = CreateObject("ADOCE.Recordset")
   If Err.Number <> 0 Then
      MsgBox "Unable to create ADOCE.Recordset " & _
         "object. Error:" & Err.Description, _
         vbCritical
      Exit Sub
   End If
   'Open database
   sql = "select * From truckinv"
   rs.open sql, ", 1, 1
   If Err.Number <> 0 Then
      MsgBox "Unable to read the Truck Inventory " & _
         "Database: Error#" & Err.Number & "-" & _
         Err.Description, vbCritical
   End If
End Sub
Listing 2 This code lets you create a recordset with all inventory records. The LoadRecords routine first creates the recordset object by calling the CreateObject method, then checks for errors after each call.