I am new to VB6.
I have a MsFlexgrid that loads data from an Access table. I have an Edit button on the same form as the MSFlexgrid control. This Edit button calls a 2nd "Edit" form.
I can Edit a record/row just fine in the Edit Form. It updates the Access table record, but does not refresh on the MSFlexgrid after exiting the Edit form.
The row contains the original value. If I edit it a second time, the Edit information box has the changed data.
In the "main form" in the Form_Load() I have:
Call UpdateGrid
' This upates the MSFlexgrid control from a recordset.
When I exit the Edit Form, I update the Access table and from
here Call "Main Form".UpdateGrid (Same sub)
What trick am I missing with the MSFlexgrid control?
Here is some of the UpdateGrid code if that matters:
Code:Public Sub UpdateGrid() Dim strSql As String Dim intRecordCount As Integer Dim intTheRow As Integer strSql = "Select name, address from names' Set rs = New ADODB.Recordset With rs .ActiveConnection = adoSupplier .CursorType = adOpenKeyset .CursorLocation = adUseClient .LockType = adLockOptimistic .Source = strSql End With rs.Open intTheRow = 0 With fgrdNames .TextMatrix(0, 0) = "Names" .TextMatrix(0, 1) = "Address" Do Until rs.EOF intTheRow = intTheRow + 1 .TextMatrix(intTheRow, 0) = rstSupplier.Fields("name").Value .TextMatrix(intTheRow, 1) = rstSupplier.Fields("address").Value rs..MoveNext Loop End With




Reply With Quote