CancelUpdate Problem

CancelUpdate Problem

Post by Ijaz » Sun, 18 Jul 1999 04:00:00



Hello

I am facing the CancelUpdate problem in VB6 for the controlls which get
input from another controlls (Not Keyboard) such as calendar or Datacombo.
If i use cancelUpdate the value are saved which i enterd.

Ijaz

 
 
 

CancelUpdate Problem

Post by Bill Hone » Sun, 18 Jul 1999 04:00:00


I have not found an fully adequate fix for this.

Instead of CancelUpdate I have used
        rs.cancelupdate
        rs.Move 0
& implemented the code suggested in this article
http://support.microsoft.com/support/kb/articles/Q228/4/51.ASP

Its a Pain in the Arse.
        Bill


>Hello

>I am facing the CancelUpdate problem in VB6 for the controlls which get
>input from another controlls (Not Keyboard) such as calendar or Datacombo.
>If i use cancelUpdate the value are saved which i enterd.

>Ijaz

---------------------------------------------------------------
 Dr. Bill Honey        I.T. Consultant
    Collage Consulting Ltd.
    Tel  0973 837620

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

 
 
 

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
        .adoMaster.Recordset.AddNew

        ' 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
    frmMaster.adoMaster.Recordset.Update

    ' restore all buttons and menus to default settings
    restoreMasterFormButtonsAndMenusToDefaults

    addFlag = False
    frmMaster.cmdCancel.Enabled = False

End Sub

=================================

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

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

        restoreMasterFormButtonsAndMenusToDefaults
    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?

Thanks,
Steve O.

2. Oracle V6 on SPARCStation ELC (Sun Sparc) - Comments ?

3. Weird CancelUpdate problem

4. YourName.Com ~ 250 Megs, CGI, ...only $29.95/month

5. CancelUpdate - problems???

6. q: explain plan cost of query

7. CancelUpdate problem

8. Forms 4.5 error; FRM-41337: Cannot populate the list from record group

9. CancelUpdate problems

10. problems with Addnew and CancelUpdate

11. problems with CancelUpdate and EditMode

12. Problem with dbgrid and CancelUpdate

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