Marsh,
I tested your suggestion and got the same results I mentioned earlier.
I figured out what is happening but I don't know how to solve it. Perhaps
there is another way to solve this.
This describes the results. This statement returns More than 18 rows:
SELECT TOP 18 JobDates.DateStart, DateDescTable.DateDesc,
JobDates.JobNumber, JobDates.DateTaskEntered, JobDates.TicketNumber,
DateDescTable.DateSF
FROM JobDates INNER JOIN DateDescTable ON
JobDates.DateType=DateDescTable.DateKey
WHERE JobDates.JobNumber=reports!jobcardprintN.Jobnumber
ORDER BY JobDates.DateStart;
For simplicity of testing, I changed TOP 18 to TOP 5 and here is what I
found. If the dates are all different then I get only 5 dates. If however
any of the 5 dates have multiple rows with the same date, I get all rows
with that date irrespective of the number of rows. There are variations on
this depending on how many dates occur on the same day. Following are some
examples:
The following would return 7 rows
09/10/2004
09/09/2004
09/08/2004
09/07/2004
09/07/2004
09/07/2004
09/07/2004
09/06/2004
The following would return only 5 rows
09/10/2004
09/09/2004
09/08/2004
09/07/2004
09/06/2004
09/05/2004
09/05/2004
09/05/2004
09/04/2004
The following would return only 5 rows
09/10/2004
09/07/2004
09/07/2004
09/07/2004
09/07/2004
09/02/2004
Marshall Barton said:
Ynot said:
Sorry to be confusing. The source of the main report is a query named
"JobsAll" that pulls together 3 tables - Job Card, Customer, and Job Start
information. The sub-report uses a query "JobDatesSubRQ" that pulls
together a date table with all dates of all items associated with a job
and
a date description table that is a standard description for each date code
in the date table.
I am using the sub-report control to match on "JobNumber" in the date
table
so that only dates associated with a single job are on the sub-report for
that job.
I am invoking the printing using a "docmd.openreport" with a
"wherecondition" Jobnumber = "Me.Jobnumber" off of an edit job card form.
This allows me to print a job card for the job that has just been changed
or
entered.
Let's try this:
Leave the main report's query as you originally had it.
Remove the subreport control's Link Master/Child properties.
Set the subreport's Record Source to this SQL statement:
SELECT TOP 18 *
FROM JobDatesSubRQ
WHERE JobNumber = Forms!editjobcardform.Jobnumber
ORDER BY [Job Start] DESC