Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ado find criteria

Status
Not open for further replies.

rogerl101

IS-IT--Management
Jan 24, 2003
25
US
I am trying to implement the Find method against and ado data control using multiple criteria and it doesn't seem to work. Here is what the code looks like

frmEditRuns.Adodc1.Recordset.Find ("RunNumber = " & varRun & " AND StationNumber = " & varLine)

This code works fine when I specify a single criteria, but when I try to combine criteria with the AND, no results

Is it possible to do this with the ado Find ?
 
The Find method simply moves the record pointer to the first record that matches the specified criterion, and thus returns only a single record. It s not permitted to combine expressions with AND or OR operators.

Use the Filter method instead.
 
Or, call the Find method twice:

zyrag, try this:

The first time use the first criteria field, starting the search at the first record in the recordset.

The second time, use the second criteria field.

For both searches use the argument "Start" set to rs.Bookmark +1 (if rs.EOF = false):
Code:
frmEditRuns.Adodc1.Recordset.Find ("RunNumber = " & varRun,,,frmEditRuns.Adodc1.Recordset.Bookmark+1

If Not frmEditRuns.Adodc1.Recordset.EOF Then
     frmEditRuns.Adodc1.Recordset.Find ("StationNumber = " & varLine,,,frmEditRuns.Adodc1.Recordset.Bookmark+1
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top