Data Access Worldwide Knowledge Base

Article ID 2325
Article Title HOWTO: Avoid Error 25 when browsing through a dbgrid where the record was removed
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2325
KBase Category VDF12
Date Created 06/13/2007
Last Edit Date 06/13/2007


Article Text
QUESTION:
When I browse through the records of a dbGrid and some other user deleted one of the records I get an error 25. I don't like getting this error and would like to make this more user-friendly. How do I do this?

ANSWER:
You can trap the routine ReadByRowId in the dbGrid object, disable the error trapping for error 25 and handle it yourself.

An example of the code will be:

    Object oOrderDtl_Grid is a dbGrid
        Set Size to 63 377
        Set Location to 90 3

        Procedure ReadByRowId RowId riRec
            Move False To Err
            Send Ignore_Error Of Error_Object_Id DFERR_REC_NOT_FOUND
            Forward Send ReadByRowId riRec
            If (Err) Begin
                Send Info_Box "I wanna do it myself"
            End
            Send Trap_Error Of Error_Object_Id DFERR_REC_NOT_FOUND
        End_procedure

        Begin_Row
            Entry_Item Invt.Item_id
            Entry_Item Invt.Description
            Entry_Item Invt.Unit_Price
            :


Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.