473,698 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with date in query

Hi,

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

SELECT Patients.PID, Patients.Lastna me, Patients.FirstN ame,
Patients.DateOf Visit, Patients.ToRepo rt
FROM Patients
WHERE (((Patients.Dat eOfVisit)>=GetS tartDate() And
(Patients.DateO fVisit)<=GetEnd Date()))
ORDER BY Patients.DateOf Visit;

(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 "DateOfVisi t" 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 1416
On 29 Sep 2004 11:33:52 -0700, Sunil Korah wrote:
Hi,

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

SELECT Patients.PID, Patients.Lastna me, Patients.FirstN ame,
Patients.DateOf Visit, Patients.ToRepo rt
FROM Patients
WHERE (((Patients.Dat eOfVisit)>=GetS tartDate() And
(Patients.DateO fVisit)<=GetEnd Date()))
ORDER BY Patients.DateOf Visit;

(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 "DateOfVisi t" 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
17327
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 dateadd(year,1,dateadd(month,-1,getdate())) AND dateadd(day,-1,(dateadd(month,1,dateadd(year,1,dateadd(month,-1,getdate()))))) *************** (first part of the date calculation comes out to be '2005-05-01' and
3
6309
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 new field table 2 has: key field (autonumber)
8
14203
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 modify it as between 1.10.2003 and 1.11.2003 for the records from 31.10.2003 show up. anybody had same problem? I check the Access Help but didn't get any clue. Thanks in advance
3
11579
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 overlap existing records from the same table. I had this all working some time ago, but recently when I have gone back to do more testing, part of these validations no longer work. While there have been changes to the code in the meantime, I cannot...
4
7743
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, but I can't update record in query or in form. I believe the problem is due to the source query. In source query, there is a filter to show the incomplete record ("is null" in delivery date)], but I need to re-use the job no. if the job is...
3
3429
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 working on. I am working with MS Access 2002. And I am having a problem with one of my charts. I will explain how everything is laid out then go into details.
14
1906
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 table I have some files made up of a name and date. For example: SUBJECT = "THIS.IS.MY.FILE", DUE DATE = "20050909", CHECKED = "false".
3
4610
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 Access 97 (I know it's old. But, it's the tool they give me to work with) My working knowledge of SQL is on the low side. My working knowledge of VBA is beginner.
20
2501
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 insert-statements. after initalizing and starting postgres 7.4 on a different port and datadirectory, i tried to import the sql-dump with the copy statements. this import fails, but importing the dump-file with inserts took a long time but was...
5
1327
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 information and one for the attendance records. I want to create a report that takes the attendance record with fields Record Number, Student ID, Date, and Type (student or instructor) and outputs it as a tabular calendar showing "S" for...
0
8603
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
9157
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
9027
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7725
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
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
2
2329
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.