use lbox recordset property w/ ado memory recordset?

This is a discussion on use lbox recordset property w/ ado memory recordset? within the ADO DAO RDO RDS forums in Framework and Interface Programming category; i created an ado memory recordset (no disk-based persistent underlying table) as follows Dim r As New ADODB.Recordset With r .Fields.Append "Field1", adVarChar, 64 .Open .Sort = "[Field1] ASC" End With then i added 2 records to r and verified that they were actually "there" record 1: Field1="AAA" record 2: Field1="BBB" then i set the recordset property for a 1-column listbox whose parent form is open, as follows Set lbox.Recordset = r now -- lbox.ListCount = 2, as it should but lbox has 2 blank lines, lbox.ItemData(0) and lbox.ItemData(1) both return NULL lbox.Column(0,0) and lbox.Column(0,1) both return NULL is there ...

Go Back   Application Development Forum > Framework and Interface Programming > ADO DAO RDO RDS

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 11-08-2008, 09:10 AM
scott w t
Guest
 
Default use lbox recordset property w/ ado memory recordset?

i created an ado memory recordset (no disk-based persistent underlying table)
as follows

Dim r As New ADODB.Recordset
With r
.Fields.Append "Field1", adVarChar, 64
.Open
.Sort = "[Field1] ASC"
End With

then i added 2 records to r and verified that they were actually "there"
record 1: Field1="AAA"
record 2: Field1="BBB"

then i set the recordset property for a 1-column listbox whose parent form
is open, as follows

Set lbox.Recordset = r

now --
lbox.ListCount = 2, as it should
but
lbox has 2 blank lines,
lbox.ItemData(0) and lbox.ItemData(1) both return NULL
lbox.Column(0,0) and lbox.Column(0,1) both return NULL

is there any way to make this really work? thanks

Reply With Quote
  #2  
Old 11-10-2008, 10:04 AM
Michel Walsh
Guest
 
Default Re: use lbox recordset property w/ ado memory recordset?

Could work in VB6, but under an Access Forms, (else than ADP) are using DAO
recordsets, not ADO recordset. There is maybe a way to use your ADO
recordset, but I never used that way of doing it, using, instead, a callback
function to fill the list box.(http://www.mvps.org/access/forms/frm0049.htm
as example).


Vanderghast, Access MVP


"scott w t" <scottwt@discussions.microsoft.com> wrote in message
news2FC338F-E162-47CE-A749-8A20BECA2ACD@microsoft.com...
>i created an ado memory recordset (no disk-based persistent underlying
>table)
> as follows
>
> Dim r As New ADODB.Recordset
> With r
> .Fields.Append "Field1", adVarChar, 64
> .Open
> .Sort = "[Field1] ASC"
> End With
>
> then i added 2 records to r and verified that they were actually "there"
> record 1: Field1="AAA"
> record 2: Field1="BBB"
>
> then i set the recordset property for a 1-column listbox whose parent form
> is open, as follows
>
> Set lbox.Recordset = r
>
> now --
> lbox.ListCount = 2, as it should
> but
> lbox has 2 blank lines,
> lbox.ItemData(0) and lbox.ItemData(1) both return NULL
> lbox.Column(0,0) and lbox.Column(0,1) both return NULL
>
> is there any way to make this really work? thanks
>



Reply With Quote
  #3  
Old 11-10-2008, 10:23 AM
scott w t
Guest
 
Default Re: use lbox recordset property w/ ado memory recordset?

Thanks. Now I can stop my fruitless search for an easy answer.

"Michel Walsh" wrote:

> Could work in VB6, but under an Access Forms, (else than ADP) are using DAO
> recordsets, not ADO recordset. There is maybe a way to use your ADO
> recordset, but I never used that way of doing it, using, instead, a callback
> function to fill the list box.(http://www.mvps.org/access/forms/frm0049.htm
> as example).
>
>
> Vanderghast, Access MVP
>
>
> "scott w t" <scottwt@discussions.microsoft.com> wrote in message
> news2FC338F-E162-47CE-A749-8A20BECA2ACD@microsoft.com...
> >i created an ado memory recordset (no disk-based persistent underlying
> >table)
> > as follows
> >
> > Dim r As New ADODB.Recordset
> > With r
> > .Fields.Append "Field1", adVarChar, 64
> > .Open
> > .Sort = "[Field1] ASC"
> > End With
> >
> > then i added 2 records to r and verified that they were actually "there"
> > record 1: Field1="AAA"
> > record 2: Field1="BBB"
> >
> > then i set the recordset property for a 1-column listbox whose parent form
> > is open, as follows
> >
> > Set lbox.Recordset = r
> >
> > now --
> > lbox.ListCount = 2, as it should
> > but
> > lbox has 2 blank lines,
> > lbox.ItemData(0) and lbox.ItemData(1) both return NULL
> > lbox.Column(0,0) and lbox.Column(0,1) both return NULL
> >
> > is there any way to make this really work? thanks
> >

>
>
>

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:35 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.