473,388 Members | 1,492 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,388 software developers and data experts.

Recordset is nothing?

Hi, I just completed an application that queried the database to see if a value existed in there, if it didn't then it did one thing, if it did it did another. at first I was using
Expand|Select|Wrap|Line Numbers
  1. If not rsblah.EOF then
and was getting Object required errors, I spent ages trying to figure out why and Google was of little use telling me I'd probably typoed, so I asked another developer and he said to do
Expand|Select|Wrap|Line Numbers
  1. If rsblah is nothing then
and it worked, he explained that sometimes rather than a query returning an empty recordset it didn't return one at all but he didn't know why so I thought I'd ask here if someone could explain that to me? I fully expected my recordset to return empty as there's no data in the table yet and the query was solid. It's not an urgent thing as the application is working now but I'm the kind of person that likes to know why something happens rather than just know it happens but have no idea why.

PS. I know one of the if statements checks for a value and the other checks for no value so my THEN statements were switched so the right thing happens so no need to worry about that
Oct 19 '07 #1
1 3712
JamieHowarth0
533 Expert 512MB
Hi spoogledrummer,

The reason will probably be because EOF means End Of File i.e. no more records or number of records returned = 0.
The context that you are using it in is If not EOF - i.e. if there are records then do whatever.
This might be causing your "Object required" errors in resulting code:

Expand|Select|Wrap|Line Numbers
  1. If Not myRecordset.EOF Then
  2.   'No records found
  3. Else
  4.  'Records found
  5.  '.... subsequent code using myRecordset eg:
  6. Response.Write(myRecordset("Field1"))
  7. End If
  8.  
In the above example, the arguments are the wrong way round for the scenario - i.e. if Not EOF (records found) then perform actions for "no records found" and vice versa. I think that this is maybe what is happening with your code?

Best regards,

medicineworker
Oct 19 '07 #2

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

Similar topics

23
by: Rob Meade | last post by:
Lo all, Ok - this is what I was aiming to do, and then I thought - naahhh, that cant be right! query database results to recordset results to array using GetRows update values in one column...
0
by: belacyrf | last post by:
Here's the code: ------------------------------------------------------------------- accessID = request("accessID") strSQL = "SELECT * From PendingAccRequests Where AccessID = "&accessID ...
8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
4
by: Gerry Abbott | last post by:
Hi all. I wish to call a recordset from a function. Ive tried the following approach, -------------------------------------------------------- Function PassRS() As Recordset Dim db As...
2
by: ano1optimist | last post by:
I have a form with a search button. I'm using command parameters to pass search criteria to a stored procedure. Here is my code: Stored procedure: CREATE PROCEDURE . @strCriteria varchar(200)...
4
by: MNC | last post by:
I'm using Access2002, and can't seem to get an updateable recordset going :-( What am I doing wrong, here's the code. The form's controls are not locked, the recordset type is Dynaset (changing...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
0
by: sneal | last post by:
A little background: We have an Access 2002 based user interface to our SQL Server 2000 database. The interface is a tabbed form with two of the tabs containing a subform. Data is pulled from the...
23
by: PW | last post by:
Hi, I'd like to close a recordset and set the database to nothing if a recordset is open if an error has occured. Leaving a recordset open and a database open isn't a good idea, right? ...
4
by: jgoodnight | last post by:
I have a function "ReturnDocumentRules" that returns a recordset. Everything works if I do not close the recordset and set it to nothing, but I know this is bad programming practice. If I do close...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.