How To Pull Data From MSFLEXGRID Row and display in text box for updating
Posted on 2004-09-29
I have an MSFLEXGRID that displays data from a recordset. The flexgrid can have many rows and I need to be able to pull the data from each row independently.
When the user clicks on a new row I need the data to change and be displayed in the following text boxes and data combos (txtItemDescription, txtLocation, txtMOBOID, dcbOwner, dcbStatus, txtItemRemovedDate). I will then update the changed data (if the user modifies anything) with cmdUpdate and rewrite the data to the database. At that point I want the MSFLEXGRID to refresh and display the newly added item (basically requery with the same SQL).
Here's the code I have that probably needs revised in order for this to work.
Private Sub MSFlexGrid2_Click()
Me.txtMoboID.Enabled = False
mode = adModeReadWrite
loc = adUseClient
ConnectToDB mode, loc, dbConString
Set rs = New ADODB.Recordset
rs.Open "select * from tblDataChild", DbCon, adOpenForwardOnly, adLockOptimistic
Me.txtItemDescription.Text = rs.Fields("ItemDescription")
Me.txtLocation.Text = rs.Fields("ItemLocation")
Me.txtMoboID.Text = rs.Fields("ItemMOBOID")
Me.dcbOwner.Text = rs.Fields("ItemOwner")
Me.dcbStatus.Text = rs.Fields("ItemStatus")
Me.txtItemRemovedDate.Text = rs.Fields("ItemRemovedDate")
Any Help Would Appreciated!!