Link to home
Start Free TrialLog in
Avatar of schoon
schoon

asked on

DBGrid: This Action was Cancelled by an Associated Object

I am editing data entered into a DBGrid. When the data is bad I set Cancel to true in DBGrid_BeforeUpdate. OK so far. However I always get the "This Action was Cancelled by an Associated Object" message when I do this (title of messagebox = "DBGrid"). I cannot get rid of this message. The closest I have come to this is in the DBGrid_Error event when VB tells me the DataError parameter = 13689 (Err.Number = 0). I tried setting this to zero but I still get the message. Help!!!!!!!!! TIA, Ed.
Avatar of fguerreiro_inix
fguerreiro_inix

I' tryed and I get no error.
Are you using bound or unbound mode?
My GOD!!!
It was happening to me all the time back then when I programmed in VBasic.
If I remember I've ended up the winner.
I chaged the names of all the objects in the same frame that referred to or had the same Name as the Data Control, except, of course THE DATA CONTROL!!!
Also, I trashed some code about the data control control that was not essential.
The damn message has disappeared!
Hope it works, good luck!
My GOD!!!
It was happening to me all the time back then when I programmed in VBasic.
If I remember I've ended up the winner.
I chaged the names of all the objects in the same frame that referred to or had the same Name as the Data Control, except, of course THE DATA CONTROL!!!
Also, I trashed some code about the data control control that was not essential.
The damn message has disappeared!

Good Luck.

Badder.
Hope it works, good luck!
Avatar of schoon

ASKER

fguerreiro_inix: It's bound.
Badder: I only have the grid and the datacontrol on the form.
Here's where I'm doing the editing:

Private Sub dbgComments_BeforeUpdate(Cancel As Integer)
    Dim sPassDate As String

    sPassDate = dbgComments.Columns(2).Text
    dbgComments.Columns(2).Text = gfs_VerifyDate(sPassDate)
    If Not basGeneral.DateValid = True Then
        MsgBox "Invalid Date", 48, "Error Message"
        Cancel = True
        Exit Sub
    End If
    If dbgComments.Columns(2).Text = "" Then
        MsgBox "You must enter a date"
        Cancel = True
        Exit Sub
    End If
    dbgComments.Columns(0).Text = CStr(m_SSN)
    dbgComments.Columns(1).Text = m_StDt
    Exit Sub
End Sub

ASKER CERTIFIED SOLUTION
Avatar of fguerreiro_inix
fguerreiro_inix

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of schoon

ASKER

Brilliant! It works! You, sir, are a genius. Thanks a bunch.
thanks a lot it works superb


thanks a lot
please let me knwow how can u not allow the user to edit 3 columns out of 5 please help