473,398 Members | 2,165 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,398 software developers and data experts.

Error using findfirst

10
I try to use findfirst command and I got error.
Could someone please help me to find the solution:?
My code is as follow

Dim db As Database
Dim rs As Recordset
Dim strCriteria As string


mdate=date-10


Set db = CurrentDb()
MsgBox strCriteria

Set rs = db.OpenRecordset("Calendar")
strcriteria=mdate


rst.FindFirst(strCriteria)' error shown as run-time error 424 object required'
If rst.NoMatch Then
MsgBox "No entry found"
Else
mrdate = hrdproc
End If
Msgbox mrdate


Thank you in advance
Apr 26 '11 #1
5 7423
Mariostg
332 100+
You Dim and Set rs, but use rst...

You should also take the habbit of declaring whether you use DAO or ADODB when you declare recordset.
Apr 26 '11 #2
moepusu
10
Thank you for your advice

I just changed and re-run the program with new criteria since my old criteria doesn't work. Another error shows. please see below


Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As string

mdate=date-10

Set db = CurrentDb()
strCriteria = "[rdate] = " & mdate
'strCriteria = mdate

MsgBox strCriteria

Set rst = db.OpenRecordset("Calendar")

With rst
.FindFirst (strCriteria)' error show - runtime error 3251, operation is not supported for this type of object
If rst.NoMatch Then
MsgBox "No entry found"
Else
mrdate = hrdproc
End If
End With
Apr 26 '11 #3
Mariostg
332 100+
I don't use the findFirst featur too often, but it appears you must specify a recordset type dbOpenSnapshot for it to work:
Set rst = db.OpenRecordset("PayList", dbOpenSnapshot)
Apr 26 '11 #4
moepusu
10
Hi
Thank you again, no more error
but, still problem

msgbox strCriteria show as 4/16/2011, since I use mdate=date-10. That is correct.

But when I write the code: msgbox mrdate nothing in there. keep showing "no entry found", Actually supposed to show 4/29/2011 according to my data.
rdate is date structure with index .
Do you have any idea?

Thank you so much
Apr 26 '11 #5
TheSmileyCoder
2,322 Expert Mod 2GB
The thing is when you later try to use the string strCriteria with the findfirst function, it will get evaluated by the JET engine. Thus instead of a date, JET will see it as 4 divided by 16 divided by 2011.

I suggest you look at this insights article here on Bytes, it will tell you all you need to know about the issue.
Literal DateTimes and Their Delimiters (#)
Apr 26 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: rwalker | last post by:
Error number 429 - COM object with CLSID {000209F0-0000-0000-C000-000000000046} is either not valid or not registered. Intermittent occurance of this error. Using Word.Global to run word macro...
4
by: Paolini | last post by:
compiling this using gcc -o xxx xxx.c I obtain this error message in function Main 6 storage size of 'ff' isn't known Can any help me ? #include <stdio.h>
3
by: Andrew Luke | last post by:
Hi all you C++ guru's! I'm 'very, very' new to C++ and I'm having a little trouble configuring my VS environment I think - when I try and compile some sample code I'm getting the following...
2
by: Ian Griffiths | last post by:
I have been given a schema, instances of which I'm required to be able to consume and generate. I'd like to be able to manipulate these instances as DataSets internally in my application. The...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
1
by: ns2k | last post by:
I add reference office.dll and Microsoft Office Excel Component to my project and use : --------------------------------------- Dim App As Excel.Application, BarName as String ... Dim Bar As...
11
by: Frankie | last post by:
Hello: New user here...first post to group. I'm getting an SQL syntax error when I try to run the following query: $query = sprintf("SELECT itemNumber, entryDate, modifyDate, thumbnailURL,...
1
Corster
by: Corster | last post by:
I went through a great deal of hassle to figure this out for myself, but now it is complete, I would like to share it with the world! I know afew other people have had trouble with FindFirst and...
4
by: Rick | last post by:
Access2003 in XP I'm using the code below to append any new records from (tbl_From_Mainframe) into (tbl_Appended_Data). It takes more than a minute to search 7000 records for a dozen new records....
0
by: sa6113 | last post by:
I am using this code to connect to a windows machine using paramiko, I have installed sshd on the machine and it works properly: sock.connect((hostname, port)) t = paramiko.Transport(sock)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
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.