When I am trying to add/edit/delete to a MSHflexgrid with the following code it will not update the database, unless I stop the program running and restart it. I would be grateful if anyone can see anything that is blatantly obvious with this code that would prevent the database to refresh correctly.


Private Sub cmdToDoAdd_Click()
With DataEnvironment1.rsComToDo
.Close
.Open "select * from todo", , adOpenDynamic
.AddNew
.Fields("ProjectID") = DataEnvironment1.rsComProjects.Fields("projectID")
End With
DataEnvironment1.rsComToDo.AddNew
frmToDo.Show 1


DataEnvironment1.rsComProjects.Requery
Set myRS = DataEnvironment1.rsComProjects.Fields("comtodoview").Value


End Sub

_---------------------------------------------------------

Private Sub cmdToDoDelete_Click()
flxToDoItems.Col = 0
tempval = "" & flxToDoItems.Text

flxToDoItems.ColSel = 4
If IsNumeric(tempval) Then
With DataEnvironment1.rsComToDo
.Close
.Open "select * from todo where uniqueID = " & tempval

If .RecordCount > 0 Then
result = MsgBox("Are you sure you want to delete the item: " & DataEnvironment1.rsComToDo.Fields("itemname").Value, vbOKCancel, "delete")

If result = 1 Then DataEnvironment1.rsComToDo.Delete

DataEnvironment1.rsComProjects.Requery

Set myRS = DataEnvironment1.rsComProjects.Fields("comtodoview").Value

End If



End With


-----------------------------------------------------------

Private Sub cmdToDoEdit_Click()
flxToDoItems.Col = 0
tempval = "" & flxToDoItems.Text

flxToDoItems.ColSel = 4
If IsNumeric(tempval) Then
With DataEnvironment1.rsComToDo
.Close
.Open "select * from todo where uniqueID = " & tempval
If .RecordCount > 0 Then
frmToDo.Show 1
End If
End With
End If

End Sub

----------------------------------------------------------

Many Thanks