|
-
Oct 10th, 2000, 10:21 AM
#1
Thread Starter
New Member
I have a datagrid whose datasource is a query returning four fields.
name, startdate, enddate, clientid
Depending on which row is selected (by clicking on any cell in that row) ,i want to assign the clientid of the selected row to a variable. How do i reference this information.
Any help gratefully recieved.
Cheers
-
Oct 10th, 2000, 01:26 PM
#2
Addicted Member
Are you using a data control to link with the datagrid? If so, selecting a row in the datagrid should automatically move the data control recordset to the corresponding record. Then all you need is:
iClientID = DataControl1.Recordset!ClientID
-
Oct 10th, 2000, 05:56 PM
#3
New Member
If your not using a data control, I use this little bit of code which has helped me out many times. The important thing in this little bit of code is that you always now which column the clientid will appear. I'm assuming the user will select through a click or doubleclick and that your clientid appears in column 0:
Private Sub Grid_DblClick()
Dim strActiveCell As String
grid.Col = 0
grid.Row = grid.RowSel
strActiveCell = grid.Text
End Sub
I hope that works for you.
flewis
-
Oct 11th, 2000, 03:45 AM
#4
Thread Starter
New Member
Thanks for you help guys. I'm still a liitle stuck though.
My recordset for the datagrid is based on a query.
Flewis i tried to use your piece of code but the compiler doesn't recognise the property .Rowsel of the datagrid.
I'm sure i'm just doing something very stupid, any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|