-
I'm having trouble getting the selected record number out of a datagrid that is bound to a ADODB recordset programmatically.
I do not wish to use an ADO control.
What I need to know is how to find out what record is selected.
the .ROW property is only returning the row number from amongst the rows that are on screen at the time, so I if I page down 30 times and click the 19th row on the screen it's returning 19. Which doesn't help at all. I need the row position in the overall recordset to determine what record is selected.
Can anyone help with this?
Eiredrake
-
Check out this code, this will tell you which row is highlighted
dgUserAdd is the datagrid
adcRptModel is the ADO Control
Private Sub dgUserAdd_Click()
Dim rs As New adodb.Recordset
Set rs = adcRptModel.Recordset
rs.Bookmark = dgUserAdd.SelBookmarks(dgUserAdd.SelBookmarks.Count - 1)
MsgBox "The bookmark is " & rs.Bookmark
End Sub