Sorry about your headache (it's an occupational hazard, buy the big bottle
of Tylenol.) For DataList you need to set the RowSource and ListField
properties, then call the ReFill method. DataSource binds the selected
value to a row, RowSource is used to populate it with prospects.
btw, Under ordinary circumstances I'd mention the inherent dangers of your
code (begging for a SQL injection attack,) and that a construct you're using
(Dim rs as new...) will tend to leak resources, but you seem inundated,
so... feel free to ask when you are ready.
Good Luck,
Mark
"Newbee Adam" wrote in message
>
>
>
> Private Sub cmdLookUpGroupInfo_Click()
> In the code below, I succesfully was able to bind and polpulate a text box
> with my select statement. But I need multiple table rows to be populated
> so I
> cannot use the text box. So I am trying to use the datalistbox or the
> datagrid (I have selcted them in project components and dragged them on
> the
> form) since they can show multirow row results from a select query. But I
> am
> totally new and can not get them to be populated with my select statement
> but
> my text box populates fine. What am I missing here. I would like to know
> how
> to use the datalist or datagrid. I am sure the answer is obvious, but this
> vb6 ado book is giving me a headache and I am stuck^$#^$#!!!!]
> please help!!!
> Dim rs As New ADODB.Recordset
> Dim strGroupLookUpCriteria As String
>
> 'Put text box value into varabiable for SQL statement
> strGroupLookUpCriteria = Trim(txtGroupLookUpCriteria)
>
> 'Set and open the recordset
> rs.ActiveConnection = moconn
> rs.CursorType = adOpenDynamic
> rs.CursorLocation = adUseClient
> rs.Open ("SELECT * FROM GroupLookUp WHERE groupnumber Like '" &
> strGroupLookUpCriteria & "'")
>
> 'bind text box txtProd to field "prod"
> Set datalistGroupInfo.DataSource = rs 'problem I had connection here
> instead
> of the recordsource
> datalistGroupInfo.DataField = "Prod"
> datalistGroupInfo.ListField = "Prod"
>
> 'Set DataGridGroupInfo.DataSource = rs 'problem I had connection here
> instead of the recordsource
> 'DataGridGroupInfo.DataField = "Prod"
>
> Set Text1.DataSource = rs 'problem I had connection here instead of the
> recordsource
> Text1.DataField = "Prod"
>
>
> .......
> --
> Adam S
>> Stay informed about: newbie - late bind datalist doesn't populate