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

Date Query on two date fields in the same query

I am trying to generate a report based on a query that will list any records where an individual has a date listed that matches the specified time for one or both of the date fields. The two fields are danpdate and testdate.


Expand|Select|Wrap|Line Numbers
  1.   SELECT PatientDemo.PatientType, PatientDemo.ClinicianName, PatientDemo.ClientName, PatientDemo.DOB, PatientDemo.FacilityName, PatientDemo.PrimaryInsurance, PatientDemo.SecondaryInsurance, PatientDemo.TertiaryInsurance, PatientDemo.DANPDate, PatientDemo.IntakeStaff, PatientDemo.TestDate, PatientDemo.TestStaff, [danpdate] & [testdate] AS Expr1, PatientDemo.[Report Received], PatientDemo.Testhours, PatientDemo.ServiceLocation
  2. FROM PatientDemo
  3. WHERE ((([danpdate] & [testdate])>=[Forms]![Report Date Range]![Beginning Date] And ([danpdate] & [testdate])<=[forms]![Report Date Range]![Ending Date]))
  4. ORDER BY PatientDemo.PatientType, PatientDemo.ClientName;

Any guidance you may be able to offer would be great. Currently, my work around is to run two seperate reports based on two seperate queries. 1 query to filter the danpdate and the other query to filter based on the testdate. I am hoping to have the two items merged together to generate one larger report intead of two. Thanks so much.
Jun 18 '07 #1
2 4160
kepston
97 Expert
Expand|Select|Wrap|Line Numbers
  1. WHERE ([danpdate] Between [Forms]![Report Date Range]![Beginning Date] And [forms]![Report Date Range]![Ending Date])
  2. Or ([testdate] Between [Forms]![Report Date Range]![Beginning Date] And [forms]![Report Date Range]![Ending Date])
  3.  
This will give you the rows where either danpdate or testdate fall in your range
I hope that is what you were asking for.
Jun 18 '07 #2
Expand|Select|Wrap|Line Numbers
  1. WHERE ([danpdate] Between [Forms]![Report Date Range]![Beginning Date] And [forms]![Report Date Range]![Ending Date])
  2. Or ([testdate] Between [Forms]![Report Date Range]![Beginning Date] And [forms]![Report Date Range]![Ending Date])
  3.  
This will give you the rows where either danpdate or testdate fall in your range
I hope that is what you were asking for.
THANKS so much. This is the first time I have had a chance to get back online after my original post. The fix worked great. Thanks!
Jun 28 '07 #3

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

Similar topics

4
by: Gleep | last post by:
Hey Guys, I've got a table called Outcomes. With 3 columns and 15 rows 1st col 2nd col 3rdcol outcome date price There are 15 rows...
1
by: Thomas Bartkus | last post by:
If we have a date/time field and are doing frequent queries WHERE {date/time field} BETWEEN TimeA AND TimeB Does it make sense, query speed wise, to create an index on the date/time field? ...
4
by: Joe User | last post by:
Hi all....I have a feeling this is going to be one of those twisted query questions, but here it goes anyways.... I want to generate a report that shows the chronology of events (represented by...
7
by: Nicolae Fieraru | last post by:
Hi All, I have a table tblProducts where I have four fields:\ Index, ProductName, EnterDate (as Date/Time - Medium Date), PurchaseDate (Date/Time - Medium Date) The EnterDate is automatically...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
11
by: Dixie | last post by:
How can I programatically, take some Date/Time fields present in a table in the current database and change their type to text? dixie
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
3
by: Harlequin | last post by:
I must start this posing by making the point that I am NOT a VB programmer and I'm something of a Newbie to MS Access. I can program in a number of languages (Java, Javascript, PERL,PHP and TCL) but...
8
by: Dr Al | last post by:
I have a table with four date fields, some of which may not be filled in based on our data entry needs. I have a criteria set as <date()-180 which is supposed to pull dates older than 180 days ago....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.