By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,593 Members | 2,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,593 IT Pros & Developers. It's quick & easy.

find method

lee123
100+
P: 556
Does anybody know what is the syntax for the "Find" method

lee123
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
Does anybody know what is the syntax for the "Find" method
The Find method of what object? In what version of VB?
Dec 10 '07 #2

lee123
100+
P: 556
I'm sorry I'm using vb6 and i want to find a customerID in a datagrid and i'm using a (adodc) I guess you can't use the data control in vb6 i tried but it says to use another control like (adodc) and I'm using access 2000 and i guess the data control don't like that either.


lee123
Dec 10 '07 #3

P: 55
I'm sorry I'm using vb6 and i want to find a customerID in a datagrid and i'm using a (adodc) I guess you can't use the data control in vb6 i tried but it says to use another control like (adodc) and I'm using access 2000 and i guess the data control don't like that either.


lee123
maybe that's because in the data control there is no find but a findfirst or a findlast. in a data control your code would look like this..
the txtInputID.text here is the id number of the customer you wish to search for. just tinker with the codes :P

Expand|Select|Wrap|Line Numbers
  1. strFind = Trim(txtInputID.Text) & "*"
  2.             strFind = "[CustomerID] like '" & strFind & "'"
  3.             daoCustomer.Recordset.MoveFirst
  4.             daoCustomer.Recordset.FindFirst strFind
  5.  
  6.             If daoCustomer.Recordset.NoMatch Then
  7.                 'record not found
  8.            Else
  9.                 'record found
  10.             End if
if using a adodc your code should be like this:

Expand|Select|Wrap|Line Numbers
  1. adoCustomer.Recordset.MoveFirst
  2.  
  3. adoCustomer.Recordset.Find "CustomerID='" & txtInputID.Text & "'"
  4.  
  5. If adoCustomer.Recordset.NoMatch Then
  6.  
  7.    'No Matching Record Found
  8.  
  9. Else
  10.  
  11.    'match found
  12. End If
Dec 10 '07 #4

Expert 5K+
P: 8,434
So, has this been any help?
Dec 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.