Solved

searching in a recordset

Posted on 2000-05-09
4
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 93
Create Files based on Cell Values in a Range in Excel 12 44
add criteria to query in VB, Access 2003 2 47
VB6 Enviroment 3 35
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 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