Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DBGrid: This Action was Cancelled by an Associated Object

Posted on 1998-11-11
7
Medium Priority
?
306 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:schoon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1488214
I' tryed and I get no error.
Are you using bound or unbound mode?
0
 

Expert Comment

by:Badder
ID: 1488215
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!
0
 

Expert Comment

by:Badder
ID: 1488216
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!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:schoon
ID: 1488217
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

0
 
LVL 3

Accepted Solution

by:
fguerreiro_inix earned 1200 total points
ID: 1488218

Try this...

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"
        SendKeys "{ESC}"
        DoEvents
        exit sub
    End If
    If dbgComments.Columns(2).Text = "" Then
        MsgBox "You must enter a date"
        SendKeys "{ESC}"
        DoEvents
        Exit Sub
    End If
    dbgComments.Columns(0).Text = CStr(m_SSN)
    dbgComments.Columns(1).Text = m_StDt
    Exit Sub
End Sub

You must also put code in dbgComments_Error event to intercept the error.
And make
Response = 0      'to prevent from error message from dbgrid  


I've tried and it works, you must be carefull with treatment of the error in dbgComments_Error.

Hope this helps
Regards

0
 

Author Comment

by:schoon
ID: 1488219
Brilliant! It works! You, sir, are a genius. Thanks a bunch.
0
 

Expert Comment

by:sonalchouhan
ID: 2514174
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
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question