General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
Assign ado datafieldsto dataGrid cols & populate
Hello everyone
I am attempting to assign data fields from access 2003 to a dataGrid in VB6. I do not want to use the the properties wizard to assign the data, I want to do it using code. This is what I have, but the dataGrid displays blank. Col headings do display as specified. The record set is defined as such:
With rstCatPrimary
.ActiveConnection = conMMM
.CursorLocation = adUseClient
.Source = "select id, primaryCode, desc from CatPrimary"
.LockType = adLockOptimistic
.Open
.MoveFirst 'move the rec pointer to the top of the data set
End With
With grdData
.
.
'Col Headers *******
.Columns(0).Caption = "Primary Key"
.Columns(1).Caption = "Primary Description"
'Col data assignments ****** (NEXT 2 LINES IS THE PROBLEM)
.Columns(0).DataField = rstCatPrimary!primarycode
.Columns(1).DataField = rstCatPrimary!Desc
End With
The grid does populate if I use the properties wizard, so the dataset is solid
Thanks in advance
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only