DataGrid control not showing data (VB6.0)
Posted on 2004-04-07
This is probably a very easy question but it's driving me nuts!
I'm using a datagrid control, and i'm trying to populate it directly from an ADO recordset. (i.e NOT using an ADO data control)
However, when my code runs allthough rows apear in the grid, indicating where the records should be, no data is displayed in the cells.
Code as below...
strSQL = "SELECT ViewFieldName,FieldName FROM tQueryFields WHERE QueryID=" & mlngQID
Set mrst = New ADODB.Recordset
mrst.Open Source:=strSQL, ActiveConnection:=cnn, CursorType:=adOpenKeyset
Set Me.dgFields.DataSource = mrst
intField = 0
For Each fld In mrst.Fields
.Visible = True
.Caption = fld.Name
.DataField = fld.Name
.Width = 2000
intField = intField + 1
Can anyone help ?