I have no problem using Msflexgrid to display table from Microsoft Access to the screen. But how do I extract the correct record from my access table for user to edit/delete when they click on certain row inside the msflexgrid?
TIA
Printable View
I have no problem using Msflexgrid to display table from Microsoft Access to the screen. But how do I extract the correct record from my access table for user to edit/delete when they click on certain row inside the msflexgrid?
TIA
When the user clicks on a row, the row property of the flexgrid is set to be that row (0 based). By looking in the correct column of that row, you should be able to get the Primary key of the table? Then finding the correct row should be no problems.
some of my problems is solved with code something like this:
private sub flex1_click()
Mtext = flex1.text
end sub
Above code indicated that I can correctly extract data into mtext when user click on different row. However it only show the column 1 text, I am trying to figure out how to extract column 2 and column text as well.
Private Sub MSFlexGrid1_Click()
MSFlexGrid1.Row = MSFlexGrid1.RowSel
MSFlexGrid1.Col = 1
data = MSFlexGrid1.Text
MSFlexGrid1.Col = 2
data = data & " " & MSFlexGrid1.Text
x = MsgBox(data)
End Sub
_______________________________________
You just need to change the COL value, either as crudely as I've done it or by looping through cols until max cols has been reached.
Bob
Thanks VBOB, your code provide a great help to me.