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