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

problem with date in query

Hi,

My table contains a date field "DateOfVisit" and I have the following
query

SELECT Patients.PID, Patients.Lastname, Patients.FirstName,
Patients.DateOfVisit, Patients.ToReport
FROM Patients
WHERE (((Patients.DateOfVisit)>=GetStartDate() And
(Patients.DateOfVisit)<=GetEndDate()))
ORDER BY Patients.DateOfVisit;

(GetStartDate() and GetEndDate() are for getting the dates which are
held in public variables into the SQL.)

When I set the start and end date variables to Date() I expect to see
the entries with the "DateOfVisit" as today, but they dont come up. If
I set the start date as an earlier date they come up along with other
records. I cant understand why?

Sunil Korah
Nov 13 '05 #1
1 1400
On 29 Sep 2004 11:33:52 -0700, Sunil Korah wrote:
Hi,

My table contains a date field "DateOfVisit" and I have the following
query

SELECT Patients.PID, Patients.Lastname, Patients.FirstName,
Patients.DateOfVisit, Patients.ToReport
FROM Patients
WHERE (((Patients.DateOfVisit)>=GetStartDate() And
(Patients.DateOfVisit)<=GetEndDate()))
ORDER BY Patients.DateOfVisit;

(GetStartDate() and GetEndDate() are for getting the dates which are
held in public variables into the SQL.)

When I set the start and end date variables to Date() I expect to see
the entries with the "DateOfVisit" as today, but they dont come up. If
I set the start date as an earlier date they come up along with other
records. I cant understand why?

Sunil Korah
Your DateOfVisit field is storing a date AND a time value.
No records will meet the <= Date() part of the criteria unless the
time value is exactly midnight.

Change the data (using an Update query) to just the date value, or
change the query criteria to >=Date() and <= Date() +1

Or .... add a new column to the query grid.
Exp:Int([DateOfVisit])

Set the criteria for this column to:= Date() and <= Date()


--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2

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

Similar topics

1
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN...
3
by: rrh | last post by:
I am trying to update a field in one table with data from another table. The problem I'm running into is I need to base the update on a range of data in the 2nd table. Table 1 has: date field...
8
by: Paul T. Rong | last post by:
I used "between and " in a query as a criteria to a field called ShipDate. Very strange, in the case between 1.10.2003 and 31.10.2003, then the records from 31.10.2003 don't show up. I have to...
3
by: Lyn | last post by:
Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not...
4
by: Apple | last post by:
1. I want to create an autonumber, my requirement is : 2005/0001 (Year/autonumber), which year & autonumber no. both can auto run. 2. I had create a query by making relation to a table & query,...
3
by: StBond | last post by:
Hi everyone, I am new to Access and Visual Basic so things my be getting across a bit cloudy. I only started using VB for one week. I am having a little problem with the database that I am...
14
by: marcokrechting | last post by:
Hi All, I have a rather complex math problem concerning dates. I will try to explain my problem. I have a table with the fields SUBJECT (text), DUE DATE (date) and CHECKED (yes/no). In this...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
20
by: Development - multi.art.studio | last post by:
Hello everyone, i just upgraded my old postgres-database from version 7.1 to 7.4.2. i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with copy-commands and to one file using...
5
by: ShadesOfGrey | last post by:
Hi, new to the group, not to Access...but it's been awhile since I've done much with it. I am creating a database that tracks student and instructor attendance. I have two tables, one for student...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
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...
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.