first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

VB Code: Generic Data Error Handler for Microsoft's DataGrid Control

Private Sub dgFields_Error(ByVal DataError As Integer, _ Response As Integer) ' 'This sub attemps to summarize the errors of the 'MS DataGrid Control. On many errors it simply reports 'that "Errors have ocurred." This sub is an attmept to 'intercept such meaningless messages. 'Note that I am using my generic message handler, 'the Public Sub basAppInfoMsg(). ' Dim strError As String

Response = 0

Select Case DataError
    Case dbgActionCanceled
        strError = "Data Grid Error 7011: ""Action is " _
           & "canceled"""
    Case dbgAddError
        strError = "Data Grid Error 6154: ""Error occurred " _
           & "while trying to add record"""
    Case dbgBadEvent
        strError = "Data Grid Error 6161: ""Operation is " _
            & "invalid within the event"""
    Case dbgBindError
        strError = "Data Grid Error 4097: ""Cannot " _
            & "initialize data bindings"""
    Case dbgCNotFound
        strError = "Data Grid Error 6147: ""Column not " _
            & "found"""
    Case dbgColIndex
        strError = "Data Grid Error 6145: ""Invalid column " _
            & "index"""
    Case dbgColReadOnly
        strError = "Data Grid Error 7010: ""The column is " _
            & "read only"""
    Case dbgConvertData
        strError = "Data Grid Error 7006: ""Data type " _
            & "conversion error"""
    Case dbgDataAccess
        strError = "Data Grid Error 6160: ""Data access "_
            & "error"""
    Case dbgDelError
        strError = "Data Grid Error 6155: ""Error occurred " _
            & "while trying to delete record"""
    Case dbgDelMultRows
        strError = "Data Grid Error 6159: ""Cannot delete " _
            & "multiple rows"""
    Case dbgErrorSetCurrent
        strError = "Data Grid Error 6152: ""Error occurred " _
            & "while trying to set current row"""
    Case dbgErrUpdateColumn
        strError = "Data Grid Error 7007: ""Error " _
            & "occurred while trying to update the column " _
            & "value"""
        End If
    Case dbgInvalidPropertyValue
        strError = "Data Grid Error 380: ""Invalid " _
            & "property value"""
    Case dbgInvalidSafeModeProcCall
        strError = "Data Grid Error 680: ""Invalid " _ 
            & "procedure call in safe mode"""
    Case dbgInvBookmark
        strError = "Data Grid Error 6149: ""Invalid " _
            & "bookmark"""
    Case dbgInvRowNum
        strError = "Data Grid Error 6148: ""Invalid row " _
            & "number"""
    Case dbgMustHaveSplit
        strError = "Data Grid Error 7002: ""Cannot delete " _
            & "last split"""
    Case dbgNoCurrentRow
        strError = "Data Grid Error 7008: ""The current " _
            & "row is not available"""
    Case dbgNoMethodNow
        strError = "Data Grid Error 7003: ""Method is not " _
            & "available in this context"""
    Case dbgNoPropNow
        strError = "Data Grid Error 6162: ""Property is "_
            & "not available in this context"""
    Case dbgNoRowFound
        strError = "Data Grid Error 7009: ""Cannot find " _
            & "the row"""
    Case dbgNoRowset
        strError = "Data Grid Error 7005: ""Rowset " _
            & "not available"""
    Case dbgNotBookmarkable
        strError = "Data Grid Error 7004: ""The rowset " _
            & "is not bookmarkable"""
    Case dbgOrphaned
        strError = "Data Grid Error 7000: ""Supporting " _
            & "object on the grid has been deleted"""
    Case dbgOutOfMemory
        strError = "Data Grid Error 7: ""Out of memory"""
    Case dbgScrollRange
        strError = "Data Grid Error 6151: ""Scroll "_
           & "arguments out of range"""
    Case dbgSplitIndex
        strError = "Data Grid Error 6244: ""Invalid split " _
            & "index"""
    Case dbgSubscriptRange
        strError = "Data Grid Error 9: ""Subscript out " _
            & "of range"""
    Case dbgTypeMismatch
        strError = "Data Grid Error 13: ""Type mismatch"""
    Case dbgUnknown
        strError = "Data Grid Error 7001: ""An unknown " _
            & "error code was received where it was not " _
            & "expected"""
    Case dbgUpdError
        strError = "Data Grid Error 6153: ""Error occurred " _
            & "while trying to update record"""
    Case Else
        Response = 1
End Select

If VBA.Len(strError) Then basAppInfoMsg (strError)

End Sub

mod date: 1999-04-25T05:27:15.000Z