[AccessD] Set a form's recordset to an ADO recordset to view records

Doug Murphy dw-murphy at cox.net
Wed Jan 26 23:44:56 CST 2011


Folks,

I am trying to create a form to review the first few rows of an excel
spreadsheet before going through an import process. These spread sheets can
be unstructured as far as which column is where and what they are called so
the user has to select which column goes in which field in the import table.
I open my ADO connection and get the field names and get a recordset from
the first work sheet. I them set it as the recordset of a form in datasheet
view expecting to see all the rows. The form loads the recordset as I can
see the row count and the record selectors, but I can't see any fields in
it. I can step through a recordset row in code and verify that there are
values. What am I missing to make the records visible?

Code snippet follows:

      sStrQuery = " Select * FROM " & sSheetName & ""

      Set rsF = New ADODB.Recordset
      With rsF
            .Source = sStrQuery
            .ActiveConnection = cn
            .LockType = adLockReadOnly
            .CursorType = adOpenStatic
            .Open
      End With

     Set Forms("frmImportVendorExcelDisplay").Recordset = rsF
           Forms("frmImportVendorExcelDisplay").Refresh

Doug




More information about the AccessD mailing list