Solved

searching in a recordset

Posted on 2000-05-09
4
181 Views
Last Modified: 2010-08-05
I have a record set defined as follows:

Dim rs_VendorList As New ADODB.Recordset
    rs_VendorList.CursorLocation = adUseClient
  rs_VendorList.Open SQLquery, ConnectionString, adOpenDynamic

There are no problem using the recordset. Later in the code I get a value and I would like ot search for that value in the recordset. I have ound the "recordset.find" method but I cannot make it work. Can anyone help me with this one?




0
Comment
Question by:scotts27
4 Comments
 
LVL 2

Expert Comment

by:Tchalkov
ID: 2792981
try
 rs_VendorList.find <criteria>

 if rs_VendorList.Eof then
'not found
else
' found
end if
0
 
LVL 2

Accepted Solution

by:
BobbyOwens earned 50 total points
ID: 2792990
I have tried the following code using the .Find and it worked. What is the error you are getting back, or what is happening?

Dim arsTest As ADODB.Recordset
 
  Set arsTest = New ADODB.Recordset
  arsTest.ActiveConnection = pacnNavigatorData
  arsTest.CursorLocation = adUseClient
arsTest.Open "SELECT * FROM fst_system", , adOpenDynamic
  arsTest.Find "SystemID='7ae72a1c-d406-11d3-842a-000629a66eb4'"
  Set arsTest = Nothing

When you do the find, you need to enter the full criteria you are looking for. What is the back end database you are using?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 2792995
Before calling the find method, use rs_VendorList.MoveFirst.

Also, be advised that the Find method allow only one criteria!
0
 

Expert Comment

by:rajeshkhatri
ID: 2795633
the syntax for finding the value in the recordset will be

rs.find <condition> , , as searchforward

rs is the recordset created through
set rs = new  ADODB.recordset

why searchforward because it search the record faster then other


0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question