Update problem

05-30-2002, 01:32 AM
Lets say that I have one MDI form and one child form.


The child form contains a button "cmdSave",ado data control, few textboxes bound to the "ado" and its data fields.

When "cmdSave" is chlicked, it executes codes that updates the ado recordset.

Private Sub cmdUpdate_Click()
On Error GoTo undoSave

If updateAdo.Recordset.EditMode = adEditAdd Then
Dim message1 As Integer
message1 = MsgBox("Are you sure you want to ADD the new record?", vbYesNo, "Add Record")
If message1 = vbYes Then
Call modSysUser.sysUserOpLog(refOpObj, "Update", "Complete", "Add Successful!")
End If
ElseIf updateAdo.Recordset.EditMode = adEditInProgress Then
bkmark = updateAdo.Recordset.Bookmark
Dim message As Integer
message = MsgBox("Are you sure you want to SAVE the following changes?", vbYesNo, "Save Record")
If message = vbYes Then
updateAdo.Recordset.Bookmark = bkmark

Call modSysUser.sysUserOpLog(refOpObj, "Update", "Complete", "Edit Successful!")
End If
End If

Exit Function
Dim msg As String
msg = Err.Description
Call modSysUser.sysUserOpLog(refOpObj, "Update", "Error", msg)

If updateAdo.Recordset.EditMode = adEditAdd Then
MsgBox "" & msg, , "Error"
ElseIf updateAdo.Recordset.EditMode = adEditInProgress Then
MsgBox "" & msg, , "Error"
MsgBox "Refreshing records", , "Recovery"
Call refreshTableByRef(updateAdo)
End If

End Sub


Everything is the same, Except I moved the "cmdSave" button to the MDI form.

While adding record:
I can succesfully execute the save method while the child forms recordset is in "adEditAdd" mode.

While editing record:
the "adEditInProgress" is only triggered if i change data in more than one fields.

Previoulsy when the "cmdSave" Button was on the child form, I only had to change data in one field and it would already trigger the "adEditInProgress" event/ set "adEditInProgress" to true.

NOTE: "adEditInProgress" and "adEditAdd" refres to the ado data control.
Also the records were changed through textboxes bould to the ado data control.

Any helo to solve this update problem will be very helpfull.

Thank you.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum