Thanks
----- John Viescas wrote: -----
What is the Primary Key of TblJobCard? I may need to know that to solve
your problem. Or, do you need to see records where a particular JobNo
occurs more than once in the date span?
If so, the solution is:
PARAMETERS [start date] datetime, [end date] datetime;
SELECT TblJobCard.JobNo, TblJobCard.OrderNo, TblJobCard.ComplainantDate,
TblJobCard.AssetNo, TblJobCard.Requirement, TblJobCard.Details,
TblJobCard.LocationNO
FROM TblJobCard INNER JOIN TblLocation ON TblJobCard.LocationNO =
TblLocation.LocationNO
WHERE TblJobCard.ComplainantDate Between [start date] And [end date]
AND 1 < (SELECT Count(*) FROM TblJobCard AS T2
WHERE T2.JobNo = TblJobCard.JobNo AND
T2.ComplainantDate Between [start date] And [end date]);
--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
Telsys said:
SELECT TblJobCard.JobNo, TblJobCard.OrderNo,
TblJobCard.ComplainantDate,
TblJobCard.AssetNo, TblJobCard.Requirement, TblJobCard.Details,
TblJobCard.LocationNO
FROM TblJobCard INNER JOIN TblLocation ON TblJobCard.LocationNO = TblLocation.LocationNO
GROUP BY TblJobCard.JobNo, TblJobCard.OrderNo,
TblJobCard.ComplainantDate,
TblJobCard.AssetNo, TblJobCard.Requirement, TblJobCard.Details,
TblJobCard.LocationNO
HAVING (((TblJobCard.ComplainantDate) Between [start date] And [end date]));
this returns all the jobs we have completed within the date range
but
doesn't yet JUST return the revisits (duplicate record of unique location
id - this has its own table) . Have tired the count you suggest but doesn't
return any data. I dont use the SQL I am only using the design form process.
Perhaps I am doing something wrong. tables. It
might
look something like:
FROM JobCards
WHERE JobCard.JobCardID IN
(SELECT JobCardID
FROM JobCards
WHERE JobCards.JobDate Between #01 JAN 2004# And #31 JAN 2004#
GROUP BY JobCardID, Location
HAVING Count(*) > 1)
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
card by
location etc.. have tables for location, customer type,
schedules and
many
more. month - as
a KPI. I can run a query from design view for selecting all
the job
cards
between dates no problem but am finding it difficult to select
only
those
within date parameter that appear more than once. a 1 so
cannot use >1 criteria.