Results 1 to 3 of 3

Thread: [RESOLVED] FlexGrid issue and error "Invalid Row value"....

  1. #1

    Thread Starter
    Member intellogo's Avatar
    Join Date
    Nov 2006
    Location
    India
    Posts
    61

    Resolved [RESOLVED] FlexGrid issue and error "Invalid Row value"....

    Hi,

    I have used a Flex Grid control in displaying a set of records from the MS ACCESS database (back end) with the means of VB6 code (front end).

    In my database i have 9 records and the flex grid control has been deisgned at design time with 7 rows.
    I have full- compiled my code and seen that NO syntax errors exist.

    ISSUE:
    At runtime, when the grid control retrieves the 9 records from the db, an error is popped up: "Invalid Row Value".
    I have tested and seen that if there are 7 records in db, then no errors occur. But, at runtime, if the records queried, exceed the no of rows in the grid control, designed at design time, then this error occurs. And even no vertical scrollbar appears.

    ----------------------------------------------------------------------
    Visual Basic 6 code:
    ----------------------------------------------------------------------
    ''''For loop counters for each cell. ex: (0,0) -> (ROW, COL)
    Dim dblRow_ISBN As Double, dblCol_ISBN As Double

    '''''coding for the DATAGRID control to populate itself with records
    '--------------------------------------------------------------
    -------------------------------------------------------------
    Call Connect_Database ''''database connection code

    recset.Open "select ISBN, [Book Title], Author, CoAuthor1, CoAuthor2 " _
    & "from " & strTable & " " _
    & "order by " & field & ""
    '-------------------------------------------------------------------

    If (recset.RecordCount <> 0) Then
    For dblRow_ISBN = 1 To recset.RecordCount
    dblCol_ISBN = 0

    grdISBN.Row = dblRow_ISBN 'ROW will be same for all the 5 columns

    grdISBN.Col = dblCol_ISBN
    grdISBN.Text = recset.Fields("ISBN")
    grdISBN.Col = dblCol_ISBN + 1
    grdISBN.Text = recset.Fields("Book Title")
    grdISBN.Col = dblCol_ISBN + 2
    grdISBN.Text = recset.Fields("Author")
    grdISBN.Col = dblCol_ISBN + 3
    grdISBN.Text = recset.Fields("CoAuthor1")
    grdISBN.Col = dblCol_ISBN + 4
    grdISBN.Text = recset.Fields("CoAuthor2")

    recset.MoveNext
    Next dblRow_ISBN
    End If
    dbconn.Close 'closes database connection

    ====================================================

    Who can really help me on this ? His help will be definately appreciated.
    Awaiting reply....
    Regards,
    intellogo

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: FlexGrid issue and error "Invalid Row value"....

    Don't hard code the # of rows.
    When loading a Flexgrid, using the TextMatrix property is more efficient than setting the Col # and then the Text property.

    Code:
    Call Connect_Database ''''database connection code 
    
    recset.Open "select ISBN, [Book Title], Author, CoAuthor1, CoAuthor2 " _ 
    & "from " & strTable & " " _ 
    & "order by " & field & "" 
    
    'start with 0 data rows. 
    grdISBN.Rows = grdISBN.FixedRows 
    'set # of columns based on fields in query
    grdISBN.Cols =  grdISBN.FixedCols + recset.Fields.Count
    
    With grdISBN
       Do Until recset.EOF
          .AddItem ""
          .TextMatrix(.Rows-1, 1) = recset.Fields("ISBN").Value
          .TextMatrix(.Rows-1, 2) = recset.Fields("Book Title").Value
          .TextMatrix(.Rows-1, 3) = recset.Fields("Author").Value
          .TextMatrix(.Rows-1, 4) = recset.Fields("CoAuthor1").Value
          .TextMatrix(.Rows-1, 5) = recset.Fields("CoAuthor2").Value
          recset.MoveNext
       Loop
    End with

  3. #3

    Thread Starter
    Member intellogo's Avatar
    Join Date
    Nov 2006
    Location
    India
    Posts
    61

    Question Re: FlexGrid issue and error "Invalid Row value"....

    Thanks for ur kindest reply...I will keep this as an alternative solution always...

    But actually i just thought of a different way to solve the "Invalid Row Issue"
    , few seconds before u replied.

    I have another post at this site. Its with Crystal Report 11

    http://www.vbforums.com/showthread.php?t=459341

    Pls help out....Awaiting ur techie help...
    Regards,
    intellogo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width