473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

FindFirst: quick suggestion

Snippets
--------
Dim mydb As Database, myset As DAO.Recordset

Set mydb = CurrentDb
Set myset = mydb.OpenRecordset("abc")
myset.FindFirst ("[S_SenderID] = 'S02'") '<< problem here

Reference: MS DAO 3.6 Object Library
Question
--------
Why does MS Access 2000 responds that "the operation is not supported
for this type of object" ?
(the method is listed when the recordset name is entered followed by a dot)

Thanks.

Nov 13 '05 #1
1 9048
cnlai wrote:
Snippets
--------
Dim mydb As Database, myset As DAO.Recordset

Set mydb = CurrentDb
Set myset = mydb.OpenRecordset("abc")
myset.FindFirst ("[S_SenderID] = 'S02'") '<< problem here

Reference: MS DAO 3.6 Object Library
Question
--------
Why does MS Access 2000 responds that "the operation is not supported
for this type of object" ?
(the method is listed when the recordset name is entered followed by a dot)


It's how you opened the recordset, I guess "abc" is a local table so
with no defining parameters on the OpenRecordset method it has defaulted
to a table type recordset, try:

Set myset = mydb.OpenRecordset("abc", dbOpenDynaset)

Then .FindFirst will work.

Hint: FindFirst is the slowest method to get to the record you want, if
you just wanted that one record then you've wasted a load of resources
opening the entire table and used a method to get a record that's barely
better than a sequential scan, instead try:

Set myset = mydb.OpenRecordset("select * from abc where s_senderid='S02'")
if myset.recordcount then...

If you have lots of records to go to, then consider opening a query that
contains just the ones you want or look into the .Index and .Seek
methods for table type recordsets, .Seek is the fastest access method
bar none, if .FindFirst was a sloth, .Seek is a tachyon
(http://dictionary.reference.com/search?q=tachyon) but with the
following caveats:

1. Only works on Access tables
2. Only works on table type recordsets, which you cannot open on linked
Access tables but you can get around that using OpenDatabase to get at
the back-end tables directly.
3. Due to the first two, any code written to take advantage of this
method is not portable, a major re-write would be necessary to upgrade
to SQL Server for instance.
--
This sig left intentionally blank
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Paul | last post by:
The 2 statements below work perfectly when using them individually. But when I try to concatenate them, they don't. rst.FindFirst " = " & OldQuoteNumber rst.FindFirst " Is Null" Can someone...
5
by: MLH | last post by:
I have a table I can open as table type recordset or a dynaset. Searching for a particular value in the table's main keyfield, which would be faster and less strain on the application......
25
by: Rick Collard | last post by:
Using DAO 3.6 on an Access 2002 database, I'm getting unexpected results with the FindFirst method. Here's the simple code to test: Public Sub FindIt() Dim db As Database, rs As Recordset...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.