I apparently am not understanding something about your setup. Is the
subreport to show the latest revision for a drawing number? Or something
else? Is the main report showing the data for a single drawing number? or
something else?
--
Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
Ken thanks for the reply. I did as you stated but it ask for the date
of
the
revision three times. Two to get into the main report then once to go
to
the
last page. I tried using the code with the RevisionNumber but I had to
enter
it 5 times and it gave me all the revisions. Is Max reserved for just
dates?
How can I get a specific revision number in the subform without having
to
type in so much when you open the main form.
Kelly
:
So your goal for the subreport is to show the data for the most recent
revision (based on the value in the Revision.RevisionDate field) for
the
main report's Title.DrawingNumber value?
If this is correct, change your subreport's query to this:
SELECT Revision.DrawingNumber, Revision.RevisionDate,
Revision.Prepared,
Revision.Checked, Revision.RevisionNote, Revision.RevisonNumber
FROM Title INNER JOIN Revision ON Title.DrawingNumber =
Revision.DrawingNumber
WHERE Revision.RevisionDate =
(SELECT Max(R.RevisonDate) AS MRD FROM
Revision AS R WHERE
R.DrawingNumber = Title.DrawingNumber);
--
Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
The setup for the main report is information about a particular job.
It
was
requested if a revision sheet could be placed at the end of the
report.
Since
I am new to Access I did not know about adding a subreport to the
footer.
So
the initial report was RevisonWorking. Since then I added this as a
subreport
which doesn't have anything in common with the main report except a
child/master relationship to a drawing number. In the query for
RevisonWorking I set the criteria to Like [Which Revison] so when
they
opened
the report it would ask the question and narrow the report to one
particular
revision. Maybe there is a better way of doing it I'm up for
suggestions
but
the ultimate goal is to select the latest revison (notes, number,
date,
prepared) and have it automatically placed at the end of the report.
The follow is the SQL for the Main report.
SELECT Circuit.RevStatus, Circuit.CircuitNumber,
Circuit.ServiceType,
Circuit.Volts, Circuit.FromEquipment, Circuit.ToEquipment,
Circuit.CablesInCircuit, Circuit.LengthOfCable,
Circuit_detail.WiresInCable,
Circuit_detail.WiresNotUsed, Circuit_detail.Size,
Circuit_detail.Material,
Title.DrawingNumber, Title.RevNumCurrent, Title.Remarks,
Title.Station,
Title.Plant, Title.Company, Title.Title, Title.Location
FROM Title, Circuit INNER JOIN Circuit_detail ON
Circuit.CircuitNumber
=
Circuit_detail.CircuitNum
WHERE (((Circuit.RevStatus) Like "A" Or (Circuit.RevStatus)="C" Or
(Circuit.RevStatus)="D"));
the sub report
SELECT Revision.DrawingNumber, Revision.RevisionDate,
Revision.Prepared,
Revision.Checked, Revision.RevisionNote, Revision.RevisonNumber
FROM Title INNER JOIN Revision ON Title.DrawingNumber =
Revision.DrawingNumber
WHERE (((Revision.RevisonNumber) Like [Which Revision]));
Kelly
:
The subreport runs its RecordSource query before the main report is
fully
ready. So each time the subreport must run, you'll get that
parameter
prompt, assuming that the parameter is a value that is supposed to
come
from
the main report.
Is that Which Revision value something that you're providing to the
main
report when you open the report, say a control on a form? If yes,
change
the
subreport's query to get its parameter value from that form.
If you're doing something else, let us know what your setup is.
--
Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/
Does anyone know how I can code and event on open for the main
report
to
look
for a parameter in the subreport. I have a field in the subreport
called
RevisonNumber. In the query for the subreport the criteria is set
to
Like
[Which Revision]. This pops up several times when you open the
main
report.
When I tried to place the like criteria on the main reports query
it
did
not
work it showed all revisions.
Kelly