Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: list box source problem

Geek News

list box source problem
"Keith G Hicks" <krh[ at ]comcast.net> 12/4/2008 5:55:23 PM
I need to populate the source of a list box from an ado recordset

Dim rec As ADODB.Recordset
Set rec = New ADODB.Recordset
rec.Fields.Append "AttyID", adBigInt
rec.Fields.Append "AttyName", adVarChar, 100
rec.Open

Then I get the value from a combo box and do the following:

rec.AddNew
rec!AttyID = Me.cboAttorneys.Column(0)
rec!AttyName = Me.cboAttorneys.Column(1)
rec.Update

rec.Sort = "AttyName"

Finally I need to set the source of the list box to the rec somehow but
that's where I get stuck.

Me.lstAttorneys.RowSource = rec.?????

I have to use Table/View/StoredProc and not ValueList as the RowSourceType
because the number of rows is so that the list exceeds 2048 characters.

How can I solve this? It's an adp so there are no local tables otherwise I'd
just us a local permanent temp table.

Thanks,

Keith


Re: list box source problem
"Keith G Hicks" <krh[ at ]comcast.net> 12/4/2008 6:57:06 PM
Never mind I guess. Everything I've found online so far seems to indicate
this is not possible. Bummer. I used a workaround that I'm not thrilled with
but it'll do for now.


"Keith G Hicks" <krh[ at ]comcast.net> wrote in message
news:O9z9%23ljVJHA.3912[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
>I need to populate the source of a list box from an ado recordset
>
> Dim rec As ADODB.Recordset
> Set rec = New ADODB.Recordset
> rec.Fields.Append "AttyID", adBigInt
> rec.Fields.Append "AttyName", adVarChar, 100
> rec.Open
>
> Then I get the value from a combo box and do the following:
>
> rec.AddNew
> rec!AttyID = Me.cboAttorneys.Column(0)
> rec!AttyName = Me.cboAttorneys.Column(1)
> rec.Update
>
> rec.Sort = "AttyName"
>
> Finally I need to set the source of the list box to the rec somehow but
> that's where I get stuck.
>
> Me.lstAttorneys.RowSource = rec.?????
>
> I have to use Table/View/StoredProc and not ValueList as the RowSourceType
> because the number of rows is so that the list exceeds 2048 characters.
>
> How can I solve this? It's an adp so there are no local tables otherwise
> I'd just us a local permanent temp table.
>
> Thanks,
>
> Keith
>


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net