Results 1 to 4 of 4

Thread: Highlight Row in DataGrid

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    Question

    I have a dataGrid bound to a recordset. I allow users to input a dln (inputDLN variable below), and I want the grid to select the row corresponding to the dln in order to update fields displayed on the screen. The code I have works perfectly as long as the dln is in the recordset. If the dln is not in the recordset, I get a data access error in the rowColChange event for the grid.

    As soon as the find command is executed, the rowColChange event is fired, before I can check whether the find was successful.

    Is there a way to check the results of the find command before the rowColChange event fires.

    Thanks for any ideas !

    Code below:

    If (dgdDLN.SelBookmarks.Count <> 0) Then
    dgdDLN.SelBookmarks.Remove 0
    End If

    DE1.rsTax_DLNs.Find "dln_nr = '" & inputDLN & "'", , , 1

    If (dgdDLN.SelBookmarks.Count > 0) Then
    dgdDLN.SelBookmarks.Add DE1.rsTax_DLNs.Bookmark
    End If

  2. #2
    Member
    Join Date
    Aug 2000
    Posts
    60
    Try inserting the following at the beginning of the event.

    For ADO:
    If recordset.EOF then
    Exit Sub
    End If

    For DAO:
    If recordset.NoMatch then
    Exit Sub
    End If

    this will check if the find succeeded before running any other code. Hope it helps.
    Barend
    JHB-SA

    Nothing is impossible, except skiing through a revolving door.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736

    Thumbs up

    That works great! Forgot to mention that I am using ADO recordsets.

    I appreciate the suggestion.


  4. #4
    Fanatic Member JCScoobyRS's Avatar
    Join Date
    Oct 2002
    Location
    Some Mountain in Colorado
    Posts
    677

    need some help with same problem

    jbart,
    I have a DataGrid and I need to have the same ability where I type text in a text box, I search the recordset, get the row num, and highlight the row. Can you help me out? Thanks, Jeremy

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