PDA

Click to See Complete Forum and Search --> : Getting Rid of a MsgBox


Dafly
Aug 4th, 1999, 12:27 AM
In VB5, I am using a data control along with a dbgrid, when I delete a row, I have it display a msgbox, but after my msgbox it displays another one saying
"This Action was cancelled by an associated object." the code I am using is

If vbKeyDelete Then
If SSTab1.Caption = "Log Information" Then
Msg = "Delete Row? (This Cannot Be Undone!)"
Style = vbYesNo + vbCritical
Title = "Remove Row"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
End If
End If
If Response = vbNo Then
Cancel = True
End If


How Can I remove the seconed msgbox?

Thank you,
Jeremy

------------------
Dafly98@aol.com

bashfirst
Aug 5th, 1999, 04:44 PM
Something else in your code is preventing the row from being deleted.... it doesn't really have anything to do with your confirmation code here. In fact, try commenting all of it out and confirm that you still get the error message. Then take a look at how you have things bound and perhaps your relationships.

Bash

JHausmann
Aug 7th, 1999, 01:34 AM
This, IMO, is one of the biggest problems with bound data controls. If a field returns an error, from the database, you don't know what caused it.

"This Action was cancelled by an associated object." can be caused by a misspelt fieldname, locks being held on the field by another user, a data-type mismatch and just about any error condition you can think of.

When I get them I usally convert what I've attempted to do to SQL and attempt a pass-through. In one of my programs, I've completely removed the code used for insert/update/deletes from my bound controls (leaving them to fetch data and populate formfields only)