Solved

searching in a recordset

Posted on 2000-05-09
4
180 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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 56
TT Auto Dashboard 13 82
vbModal 12 34
Excel Automation VBA 19 30
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now