Change error message in datagrid vb6

Posted on 2014-08-11
Last Modified: 2014-08-14
I have a datagrid that connect to my sql relational database.  When I pull up the table on my datagrid, if I try to delete a row that has a foreign key I get the error message

"the delete statement conflicted with the reference constraint.....the conflict occurred in database...."

How can I change this error message when someone is trying to unsuccessfully delete a row to something else such as:

"This row cannot be deleted since there are hours already for this user"
Question by:al4629740
    1 Comment
    LVL 9

    Accepted Solution

    You could use the DataGrid Error Event:
    You can catch the dataerror-number, display your own messagebox and then set the response to zero, so that the standard error message does not show

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Title # Comments Views Activity
    Watch V7 9 49
    create a utf8 text file using vba 2 72
    Input past end of file vbs script 9 57
    Put text in a picture ASP.NET C# 2 23
    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    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…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now