473,769 Members | 5,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FindFirst: quick suggestion

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

Set mydb = CurrentDb
Set myset = mydb.OpenRecord set("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 9093
cnlai wrote:
Snippets
--------
Dim mydb As Database, myset As DAO.Recordset

Set mydb = CurrentDb
Set myset = mydb.OpenRecord set("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.OpenRecord set("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.OpenRecord set("select * from abc where s_senderid='S02 '")
if myset.recordcou nt 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
33366
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 please let me know how its done. Thanks in advance.
5
5868
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... FindFirst method - or - Seek method?
25
3922
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 Dim sCriteria As String Set db = DBEngine.Workspaces(0).Databases(0) Set rs = db.OpenRecordset("tblTest", dbOpenDynaset)
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.