Bookmark invalid?! 
Author Message
 Bookmark invalid?!

I am currently trying the True DBGrid, and the Unbound RDO Class
sample.  Whenever I run the code below, I get Bookmark invalid.  Any
ideas?

TIA,
Steve H.

    Dim Col As TrueDBGrid50.Column,  Cols As TrueDBGrid50.Columns
    Dim Flds As rdoColumns, strDSN As String, strSQL As String, C As
Integer

    mSQL = "SELECT RecNum,SSN,LastName,BirthDate,Phone from tbl_emp"
    Set ordoRS = ordoConn.OpenResultset(mSQL, rdOpenKeyset,
rdConcurRowVer)
    ResultSet = ordoRS
    Attach Nothing
    Set Cols = cntl.Columns
    Set Flds = ordoRS.rdoColumns
    While Cols.Count
        Cols.Remove 0
    Wend
    cntl.ReBind
    For C = 0 To ColCount - 1  ' Configure the grid
        Set Col = Cols.Add(C)
        Col.Caption = Flds(C).Name
        Col.Visible = True
        Col.HeadFont.Bold = True
    Next C
    Attach cntl  ' Associate the grid object with our class
    cntl.Bookmark = Null  ' Reinitialise the grid
    cntl.ReBind
    cntl.ApproxCount = RowCount  ' Callibrate VScroll bar



Sat, 09 Dec 2000 03:00:00 GMT  
 Bookmark invalid?!

Yes, the problem is a very BIG BUG of the DBGrid which accepts only
AlphaNumeric Bookmarks and not Numeric bookmarks.

RDO uses numeric bookmarks... this is the problem

So, when using the DBGrid with RDO I suggest to map the bookmark through 2
fxs so that you may change the bookmark from numeric to alphanumeric. For
example, here you are 2 sample functions with no error checking:

' The following fx may be used when storing the bookmark to the grid
' See below.
function getBookmark(bm)

    getBookmark = "K" & bm & "K"

end function

' The following fx may be used when storing the bookmark to the grid
' See below.
sub SetBookmark(rs as rdoResultset, bm)

    rs.bookmark =   mid$(bm, 2, len(bm)-2)

end function

' How to use them:
'
' 1) When loading the grid in the UnBound event:

    ...
        rowbuf.bookmark(i)=getBookmark(rs.bookmark)
    ...

' 2) When reading the record

    ...
        setbookmark  rs, dbg.bookmark
    ...

Very simple? Yes, it is. Also, this is not a bug for Apex. Bye


Quote:
>I am currently trying the True DBGrid, and the Unbound RDO Class
>sample.  Whenever I run the code below, I get Bookmark invalid.  Any
>ideas?

>TIA,
>Steve H.

>    Dim Col As TrueDBGrid50.Column,  Cols As TrueDBGrid50.Columns
>    Dim Flds As rdoColumns, strDSN As String, strSQL As String, C As
>Integer

>    mSQL = "SELECT RecNum,SSN,LastName,BirthDate,Phone from tbl_emp"
>    Set ordoRS = ordoConn.OpenResultset(mSQL, rdOpenKeyset,
>rdConcurRowVer)
>    ResultSet = ordoRS
>    Attach Nothing
>    Set Cols = cntl.Columns
>    Set Flds = ordoRS.rdoColumns
>    While Cols.Count
>        Cols.Remove 0
>    Wend
>    cntl.ReBind
>    For C = 0 To ColCount - 1  ' Configure the grid
>        Set Col = Cols.Add(C)
>        Col.Caption = Flds(C).Name
>        Col.Visible = True
>        Col.HeadFont.Bold = True
>    Next C
>    Attach cntl  ' Associate the grid object with our class
>    cntl.Bookmark = Null  ' Reinitialise the grid
>    cntl.ReBind
>    cntl.ApproxCount = RowCount  ' Callibrate VScroll bar



Mon, 11 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bookmark invalid?!

2. Bookmark invalid?!

3. Bookmark invalid?!

4. Bookmark invalid?!

5. invalid bookmark

6. A2K - invalid bookmark??

7. Run Time Error 3159 - Invalid Bookmark - MS Access 97

8. Invalid bookmark error

9. Invalid Bookmarks

10. Run time Error 3159 - Invalid bookmark

11. Invalid Bookmark Error ??

12. Invalid bookmark

 

 
Powered by phpBB® Forum Software