Between two dates from different tables

  • Thread starter Rice via AccessMonster.com
  • Start date
R

Rice via AccessMonster.com

I'm trying to create a query the will retrieve data based on the dates the
user enters. i set up the parameters and under my dates field I have the
criteria set as like[startdate] and datepending the criteria is like[enddate]
and I'm trying to have my query to pull only the fields between those dates.
But I'm not having any luck. Please help!
 
M

Michel Walsh

You may add, under each date field to be compared, the criteria:

BETWEEN CDate(startDate) AND CDate(endDate)


Hoping it may help,
Vanderghast, Access MVP
 
R

Rice via AccessMonster.com

The EmpId is in both tables datameasure and pending.
Dataneasures.dates
pending.date_pending

my query is pulling field from both tables but the pending.date_pending is
the friday date of the week that's why i need to retrieve the date from
between both dates. thanks for any help you could offer.

KARL said:
What are the table and field names? How are the tables related?
I'm trying to create a query the will retrieve data based on the dates the
user enters. i set up the parameters and under my dates field I have the
criteria set as like[startdate] and datepending the criteria is like[enddate]
and I'm trying to have my query to pull only the fields between those dates.
But I'm not having any luck. Please help!
 
K

KARL DEWEY

First do a union query --
All_EmpID ---
SELECT EmpId
FROM Dataneasures
UNION SELECT EmpId
FROM pending;

SELECT EmpId, Dataneasures.dates, pending.date_pending


--
KARL DEWEY
Build a little - Test a little


Rice via AccessMonster.com said:
The EmpId is in both tables datameasure and pending.
Dataneasures.dates
pending.date_pending

my query is pulling field from both tables but the pending.date_pending is
the friday date of the week that's why i need to retrieve the date from
between both dates. thanks for any help you could offer.

KARL said:
What are the table and field names? How are the tables related?
I'm trying to create a query the will retrieve data based on the dates the
user enters. i set up the parameters and under my dates field I have the
criteria set as like[startdate] and datepending the criteria is like[enddate]
and I'm trying to have my query to pull only the fields between those dates.
But I'm not having any luck. Please help!
 
K

KARL DEWEY

Wrong click --
First do a union query --
All_EmpID ---
SELECT EmpId
FROM Dataneasures
UNION SELECT EmpId
FROM pending;

SELECT EmpId, Dataneasures.dates, pending.date_pending
FROM (All_EmpID LEFT JOIN [Dataneasures] ON [All_EmpID].EmpId =
[Dataneasures].[EmpId]) LEFT JOIN [pending] ON [All_EmpID].EmpID =
[pending].All_EmpID
WHERE (Dataneasures.dates Between [Start Date] And [End Date]) AND
pending.date_pending Between [Start Date] And [End Date];

--
KARL DEWEY
Build a little - Test a little


KARL DEWEY said:
First do a union query --
All_EmpID ---
SELECT EmpId
FROM Dataneasures
UNION SELECT EmpId
FROM pending;

SELECT EmpId, Dataneasures.dates, pending.date_pending


--
KARL DEWEY
Build a little - Test a little


Rice via AccessMonster.com said:
The EmpId is in both tables datameasure and pending.
Dataneasures.dates
pending.date_pending

my query is pulling field from both tables but the pending.date_pending is
the friday date of the week that's why i need to retrieve the date from
between both dates. thanks for any help you could offer.

KARL said:
What are the table and field names? How are the tables related?
I'm trying to create a query the will retrieve data based on the dates the
user enters. i set up the parameters and under my dates field I have the
criteria set as like[startdate] and datepending the criteria is like[enddate]
and I'm trying to have my query to pull only the fields between those dates.
But I'm not having any luck. Please help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top