T
Ted
i'm into this marsh, but i'm getting a "Syntax error (missing operator) in
query expression 'T1.Cycle + 1 As Cycle = T2.Cycle" message from the code as
created thus far
SELECT T1.[Patient Number], T1.Cycle, T1.[AE Description], T1.Subtype,
T1.Onset, T1.Resolved, T1.[Continuing as of], T1.Grade, T1.Attribution,
T1.Serious, T1.Action, T1.Outcome, T1.DLT, T1.[AER Filed],
T1.ContinuingEndCycle, T1.Updates
FROM [Adverse Events (child)] AS T1 LEFT JOIN [Adverse Events (child)] AS T2
ON (T1.Cycle+1 as Cycle = T2.Cycle), AND (T1.[Patient Number]=T2.[Patient
Number]),
AND (T1.[AE Description] = T2.[AE Description]),
AND (T1.Subtype = T2.Subtype),
AND (T1.Onset = T2.Onset)
WHERE T2.[Patient Number] Is Null And T1.[Patient Number]=1328164 And
T1.ContinuingEndCycle="Yes";
it won't even let me save the modified version you see above?
-ted
query expression 'T1.Cycle + 1 As Cycle = T2.Cycle" message from the code as
created thus far
SELECT T1.[Patient Number], T1.Cycle, T1.[AE Description], T1.Subtype,
T1.Onset, T1.Resolved, T1.[Continuing as of], T1.Grade, T1.Attribution,
T1.Serious, T1.Action, T1.Outcome, T1.DLT, T1.[AER Filed],
T1.ContinuingEndCycle, T1.Updates
FROM [Adverse Events (child)] AS T1 LEFT JOIN [Adverse Events (child)] AS T2
ON (T1.Cycle+1 as Cycle = T2.Cycle), AND (T1.[Patient Number]=T2.[Patient
Number]),
AND (T1.[AE Description] = T2.[AE Description]),
AND (T1.Subtype = T2.Subtype),
AND (T1.Onset = T2.Onset)
WHERE T2.[Patient Number] Is Null And T1.[Patient Number]=1328164 And
T1.ContinuingEndCycle="Yes";
it won't even let me save the modified version you see above?
-ted
Marshall Barton said:Comments inline below.
--
Marsh
MVP [MS Access]
i'm a little confused by this (below)
what i ultimately want to let the user do is press a 'DUPLICATE RECORDS'
button which actuates something behind the scense. the user can always be
assumed correctly to have this button available to him/her at the bottom of
the sub-form he is using to view some combination of Patient Number and Cycle
number.
when the user clicks the DUPLICATES RECORDS button, its effect is to go
through all the sub-form records having a 'Yes' for 'Continuing at end of
cycle' and duplicate them into the next cycle (which he will have been
previously advised to guarantee already exists in the mainform).
regarding your remarks above, i believe that if a record is marked as
'Continuing...' the point is that it must appear in the subsequent cycle and
that user is too lazy to want to have to bother herself with manually
entering the same information into the sub-form for that record. so i don't
think it's an issue, or to put it another way, i think you've hit on a
non-issue.
Good.
on the flip-side of this, there may be a problem arising from the primary
keys which are comprised of all of the following in this order: Patient
Number, Cycle, AE Description, Subtype, Onset......
That will just make the query a little messier
if each time the button is clicked, the effect is to unfailingly try to
duplicate every record that meets the Where criteria, the don't you run afoul
of the constraint imposed by the pk. if i'm right, then possibly we need to
have a field in the sub-form table called 'Duplicated' which by default is
'No' and which the sql query toggles to 'Yes' and which is added into the
where clause so as to overlook any records not having 'Duplicated' = 'No' and
thefore avoid duplicating previously duplicated records.
No need for that. The query will only duplicate the ones
that have not been duplicated before. That's what Joining
the table to itself and the Is Null criteria are for. We'll
just have to expand the ON clause to include all the PK
fields.