Access 2002: bind adodb recordset to listbox recordset property

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

I would like to bind a disconnected ADODB (v2.7) recordset to a listbox's
recordset property. For some reason, the values aren't being displayed.

here's the form's coding:

....
'i create the recordset
Set m_TableDefinition = New ADODB.Recordset
With m_TableDefinition
.CursorLocation = adUseClient
.Fields.Append "Location", adVarChar, 50
.Fields.Append "Name", adVarChar, 255
.Fields.Append "Alias", adVarChar, 255
.Fields.Append "DLL", adVarChar, 50
.Fields.Append "DSN", adVarChar, 50
.Fields.Append "UserId", adVarChar, 50
.Open
End With

....
set rs = myobject.Recordset

'rs has rows
debug.print rs.recorcount

Me.lstTables.RowSourceType = "Table/Query"
Set Me.lstTables.Recordset = rs

what am i missing? i've tried rs.movefirst for the set me.lsttables line to
no effect.

thanks,

craig buchanan
 
after further testing, i have discovered:

* when i enumerate the .recordset property, there are values
* when i enumerate the listbox's column property, there are only nulls.
the number of columns and rows, however are correct
* when i switch from ado 2.7 to 2.1 (this was the original reference),
the results above are the same.

does the .recordset property only work with a DAO recordset? what am i
missing here?
 
Looks like the issue had to do w/ the LockType property. These settings
work: adLockOptimistic,adLockPessimistic. These settings don't work:
adLockBatchOptimistic,adLockReadOnly. Apparently, the default setting is
adLockReadOnly.

The CursorType property does not seem to have an effect.

While CursorLocation property does not seem to have an effect, I have read
that adUseClient is recommend. The default is adUseServer

Craig Buchanan
 
Back
Top