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

recordset incorretcly resulting in (EOF and BOF) = True

171 100+
Hi,
I have got this code to interogate a time card table, it selects all records where a the currently signed in user has logged his time in on todays date, and not logged his time out.

The issue is that even when I the User has logged in and not logged out on the day, the result of the recordset is still rst.EOF = True and rst.BOF = True, which indicates the recordset is empty. when I run this query in the query builder it comes up with a record (I.E. rst.EOF = False and rst.BOF = False).

Expand|Select|Wrap|Line Numbers
  1. Dim strSQLEndNull  as String
  2. strSQLEndNull = "SELECT Date, UserID, TimeEnd " & _
  3. "FROM tblTimeCard " & _
  4. "WHERE Date= #" & Date & "# AND UserID = '" & CurrentUser & "' " & _
  5. "AND TimeEnd Is Null AND TimeIn Is Not Null"
  6. Set cnn = CurrentProject.Connection
  7. rst.Open strSQLEndNull, cnn, adOpenDynamic, adLockOptimistic
Thanking You
Oct 1 '08 #1
4 2700
puppydogbuddy
1,923 Expert 1GB
I think your problem is that you did not include TimeIn on the selection list. Try including it and tell me what happens.
Oct 5 '08 #2
ADezii
8,834 Expert 8TB
In addition to what puppydogbuddy has said, since [TimeIn] and [TimeEnd] are Date/Time values, you may also need the '#' Delimiter for these Fields:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQLEndNull  As String
  2. strSQLEndNull = "SELECT Date, UserID, TimeEnd " & _
  3. "FROM tblTimeCard " & _
  4. "WHERE Date= #" & Date & "# AND UserID = '" & CurrentUser & "' " & _
  5. "AND #" & TimeEnd & "# Is Null AND #" & TimeIn & "# Is Not Null"
  6.  
  7. Set cnn = CurrentProject.Connection
  8. rst.Open strSQLEndNull, cnn, adOpenDynamic, adLockOptimistic
Oct 5 '08 #3
iheartvba
171 100+
Thanks Guys I have just used the query builder to build this query, but I will definatley keep that in mind for next time.

Much Appreciated
Oct 8 '08 #4
MikeTheBike
639 Expert 512MB
Hi

My only other thought is, if you are in the UK (or not usung US dates then perhaps you need this in the code version

WHERE Date= #" & format(Date,”mm/dd/yy”) & "# AND ……

Just a thought as this does not apply to queries in the query designer and continually trips me up (I never learn)!

??

MTB
Oct 8 '08 #5

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

Similar topics

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...
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
12
by: Mike MacSween | last post by:
rst.eof = true and rst.bof = true or rst.movelast rst.recordcount = 0 ?
1
by: Ray Holtz | last post by:
I have a database in Access 2003 (Access2000 file format). There are two tables that are being used: Employees and Items. It is linked by the Employee field so that one employee can have many...
7
by: MLH | last post by:
Here's a blurb cut from A97 HELP on BOF/EOF: When you open a Recordset object that contains at least one record, the first record is the current record and the BOF and EOF properties are False;...
1
by: anniefs | last post by:
hi help me i m so much stuck int he code and i have no time .... i used ASP VBscipt and javascript functions with MS database javascript function add records in MS DB by using ASP vbscript...
2
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my...
2
by: Yaara Mac | last post by:
Hi all, I need some help with using recordset.bof / oef. I'm using HTML file to display XML records page by page. I need to disable the moveNext button once it reaches the end of the file...
3
rsmccli
by: rsmccli | last post by:
Access 2002 Hi. I have a command button that will "approve" all records currently being looked at by an "approver". For some reason, even though there are multiple records that exist in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.