|
-
Aug 22nd, 2000, 10:42 AM
#1
Thread Starter
Fanatic Member
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
-
Aug 22nd, 2000, 12:02 PM
#2
Member
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.
-
Aug 22nd, 2000, 12:13 PM
#3
Thread Starter
Fanatic Member
That works great! Forgot to mention that I am using ADO recordsets.
I appreciate the suggestion.
-
Oct 10th, 2002, 05:56 PM
#4
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|