Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve record number from clicking on data grid

Status
Not open for further replies.

smcmanus

Technical User
Aug 1, 2001
25
CA
I have a data grid and when I click on a row, I want to know which record number it is in the recordset object.
 
You could use the following to get what you want. I am putting the value in a text box for example purposes but you could do whatever with the value:

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Text1.Text = DataGrid1.Row + 1
End Sub

The row property is zero based so I am adding one to it to give the actual record number. Hope this is what you were looking for. :)

 
Jitter...

This works fine, but when you scroll down the DataGrid, the rows number will always reset to the number your on in the DataGrid, therefore never getting a true position in the recordset.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top