problems with CancelUpdate and EditMode

problems with CancelUpdate and EditMode

Post by Scott Whittlese » Sat, 08 Jan 2000 04:00:00

I'm working with a simple form generated by the Data Form wizard, with an
ADODC and several bound controls.  Using ADO 2.1.   I created the recordset
in code and assigned it to the ADODC.Recordset property.

I added a button that does a CancelUpdate on the dc's Recordset.  When I
click the button, the WillMove event fires with reason adRsnMoveLast but
then things get weird.

First, when I try to check the value of Recordset.EditMode, I get error
3021: "Either BOF or EOF is True, or the current record has been deleted;
the operation requested by the application requires a current record. "

This has got to be a bug - why would an error occur just trying to check a

Second, even though MoveComplete fires with adRsnMoveLast and no errors, the
data control ends up on record -1 and all dc buttons except "next" are
disabled (and "next" doesn't do anything).

I can get around this by adding a Recordset.MoveLast statement after the
.CancelUpdate, but this should not be necessary.

Anybody have any ideas?



1. CancelUpdate problems

CancelUpdate is not cancelling my updates or Add commands.  Sample
code follows (the sub which calls the cancel command is at the end):

Public Sub AddRecord()
    ' Adding a tenant is a two step process.  First we will invoke the
    ' add command, then the update command.  So, this button has two

   '  roles

    If addFlag = False Then  ' we are just starting the add operation
        Call AddingTenantsStart

    ElseIf addFlag = True Then  
                         ' we are (hopefully) finishing the add op

        Call addingTenantsFinish
     End If

End Sub


Public Sub AddingTenantsStart()

    With frmMaster

        ' enable fields for data entry
        setAllMasterDisplayFieldsEnabledToValue (True)

        ' add new record

        ' set all text and combo boxes to empty or initial values
        ' Code not shown here  

        ' Modify display buttons
        ' Some code deleted
        .cmdCancel.Enabled = True  
                   ' So the user can cancel the operation

        addFlag = True        
    End With
End Sub


Public Sub addingTenantsFinish()

    ' update the record

    ' restore all buttons and menus to default settings

    addFlag = False
    frmMaster.cmdCancel.Enabled = False

End Sub


Private Sub cmdCancel_Click()
    ' check if we are adding or updating
    If addFlag = True Then

'  I tried both of the following -- neither helped:
'        adoMaster.Recordset.Refresh
'        adoMaster.Recordset.Delete

    End If
End Sub


So, I click on the Add button, and start to add some stuff to the data
fields.  Then -- BEFORE clicking Add a second time, which would invoke
the Update operation -- I click Canel to invoke the
recordset.CancelUpdate command.   But, the application still displays
the new record with the newly added information, and it's been added
to the database.  Someone suggested trying only .Cancel or
CancelBatch, but those don't help.

What am I missing?

Steve O.

2. OLE DB and Oracle

3. Weird CancelUpdate problem

4. Error during "Relinking Oracle Reports3.0 exe..

5. CancelUpdate Problem

6. (PDXJOBS) Oracle DBA

7. CancelUpdate - problems???

8. D/FW SQL Contractor Needed

9. problems with Addnew and CancelUpdate

10. CancelUpdate problem

11. Problem with dbgrid and CancelUpdate

12. Problem: CancelUpdate FAILS for a DataGrid bound to Oracle database

13. CancelUpdate problems