hi :) can anyone tell me how to pass data from datagrid to several textboxes. I have a textbox where the user can search a data. The data searched would display in the datagrid, so when I clicked on a data from the datagrid, it will be distributed to their respective places. I've done searching for it but I can't seem to find the right way to do it.
I'm using MS Access 2003 and Visual Basic 6.0.

Hope you can help me. :)

7 Years
Discussion Span
Last Post by AndreRet

Hi Problematic. It seems that I have missed your post being new year and all.:)

You can try the following -

Text1.Text = Datagrid1.TextMatrix(Datagrid1.Row, 1) 'The 1 at the end refers to the coloumn value in the grid, in this case coloumn 1...

@Chris, I think if you bind the textbox to the recordsource, it will only load the data from the last row. Once the data has been loaded to the grid there i no more interaction with the datasource.

The code that I have supplied above will load the text box with a value every time a row is selected in the datagrid.


That is not my understanding. A bound textbox displays the data at the cursor, ie the current row in the datagrid.


I do apologize, I did not know that you were making use of a data control. That way the bound text boxes will show the values. This will however not work in making use of ADO etc.

Some kudos for overseeing the obvious.:)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.