Continued Grid Woes (Refreshing The Grid) 
Author Message
 Continued Grid Woes (Refreshing The Grid)

This code snippet is attached to an "Update" button that will take the new
values from some text boxes and hopefully update the grid. The values seem
to update the underlying record however when I call the .additem method
again it appears to add another record to the grid. If I exit the program
and reenter looking at the same record it did not actually add another
record but the grid appears to display two records. I think I have a grid
refresh issues but I'm unsure the proper method of refreshing. Can someone
enlighten me please.

Private Sub cmdUpdate_Click()
Dim FlowIndex As String
Dim SQL As String
Dim rs As ADOCE.Recordset
Set rs = CreateObject("adoce.recordset.3.1")

FlowIndex = Me.GridVitals.TextMatrix(GridVitals.RowSel, 0)
SQL = "SELECT * FROM tblFlowSheet WHERE strVitalIndex = '" & FlowIndex & "'"

rs.Open SQL, dbPath, adOpenKeyset, adLockOptimistic

If Me.txtVitalTime <> "" Then
rs.Fields("dtmTime") = CDate(Me.txtVitalTime)
Else
rs.Fields("dtmtime") = Null
End If

rs.Fields("strPulse") = Me.txtPulse
rs.Fields("strResp") = Me.txtResp
rs.Fields("strSaO2") = Me.txtSaO2
rs.Fields("strSystolic") = Me.txtSystolic
rs.Fields("strDiastolic") = Me.txtDiastolic
rs.Update
Me.GridVitals.Redraw = True
'Clear the contents
Me.txtVitalTime = ""
Me.txtPulse = ""
Me.txtResp = ""
Me.txtSaO2 = ""
Me.txtSystolic = ""
Me.txtDiastolic = ""
Me.cboRhythm = ""
Me.txtComment = ""

'Redraw the Grid and hide the redraw

While Not rs.EOF
Me.GridVitals.AddItem rs("strVitalIndex") & vbTab & rs("REMStatID") & vbTab
_
& FormatDateTime(rs("dtmTime"), vbShortTime) & vbTab & rs("strPulse") &
vbTab & rs("strResp") & vbTab _
& rs("strSaO2") & vbTab & rs("strSystolic") & "/" & rs("strDiastolic") &
vbTab _
& rs("strRhythm")
rs.MoveNext
Wend

End Sub

Respectfully,

John D Kostenbader
Med-Media, Inc.



Sun, 19 Sep 2004 04:51:13 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Refresh data grid

2. data grids/ms flex grids

3. True DB Grid 5.0 - Sort a grid

4. DB Grid to DB Grid Question!

5. Refreshing Grid w/Oracle ADO & DE

6. refresh grid

7. Refresh on a database / data grid and remember position (VB4)

8. Refreshing a single row of a grid

9. True Grid/Data Control not refreshing

10. How can I refresh data in data grid after add new/edit

11. How can I refresh/requery data in data grid after add new/edit

12. Refresh data in Data Grid Control

 

 
Powered by phpBB® Forum Software