PDA

Click to See Complete Forum and Search --> : Selecting a record in a recordset


billwagnon
Oct 27th, 1999, 08:55 AM
How do you know which record was selected in a DataGrid? I have programmatically linked the datagrid to a recordset of two joined tables. I think in the click event for the datagrid I should be able to use the bookmark, or the row, to ascertain which of the records was clicked on.
From there I want to pick up two of the elements of the recordset, and create a new join based on the two values.

This works with a combobox by using the index property - on a click, I set a variable equal to the index, move to the first record, and then count through to the one I want.

This seems like it should be just as easy with a datagrid - but I am baffled and bamboozled!

Vit
Oct 27th, 1999, 01:41 PM
When you click datagrid to select a row, the record you mark becomes current and recordset pointer automatically skips to it. You don't have to write any code to determine it

JHausmann
Oct 29th, 1999, 11:38 AM
I use dbgrid, which allows you to specify the column value to select data. For example:


sID = form.dbgrid.columns(0).value

sets sID to whatever is stored in the selected row, column 0. You just need to know what columns you're interested in...

[This message has been edited by JHausmann (edited 10-30-1999).]