Re: Writing Executable VBA Statements
From: Ted (Ted_at_discussions.microsoft.com)
Date: 02/10/05
- Next message: MN: "Re: text box search form"
- Previous message: Can you post a sample of your code: "RE: Command not available"
- In reply to: Marshall Barton: "Re: Writing Executable VBA Statements"
- Next in thread: Marshall Barton: "Re: Writing Executable VBA Statements"
- Reply: Marshall Barton: "Re: Writing Executable VBA Statements"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 10 Feb 2005 07:13:06 -0800
i'm not sure if the system 'took' my last reply to your posting below marsh,
so i'll reprise it (and i found that in the code i posted as written i
overlooked adding the final AND from yours)
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)
AND (T1.Cycle + 1 = T2.Cycle)
WHERE T2.[Patient Number] Is Null And T1.[Patient Number]=1328164 And
T1.ContinuingEndCycle="Yes";
is the way the SQL query stands at present. when i try to run ("!") it, the
following message "Syntax error (missing operator) in query expression
'T1.Cycle + 1 As Cycle = T2.Cycle" is returned.
i see that in my code above the same expression appears more than once,
following, as i'm trying to your posting's instructions. i've tried massaging
it on the assumption i misunderstood the syntax and still no cigar.
-ted
"Marshall Barton" wrote:
> Ted wrote:
> >right, i'll cool my jets...
> >
> >and with that, things appear to have gone a bit awry for some reason.
> >
> >the code below:
> >
> >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.[Patient Number]=T2.[Patient Number]) AND (T1.Cycle+1=T2.Cycle)
> >WHERE T2.[Patient Number] Is Null And T1.[Patient Number]=01328164 And
> >T1.ContinuingEndCycle="Yes";
> >
> >which i'm pasting as copied from the sql view window returns the desired
> >patient number when the continuingcycle value is 'Yes' but it doesn't bump up
> >the value of the cycle number by '1'.
>
>
> Good catch. I missed that.
>
> Just change the T1.Cycle in the field list above to:
>
> T1.Cycle + 1 As Cycle
>
> As you pointed out in another post, the ON clause needs to
> include all the PK fields:
>
> ON (T1.[Patient Number]=T2.[Patient Number])
> AND (T1.[AE Description] = T2.[AE Description]),
> AND (T1.Subtype = T2.Subtype),
> AND . . .
> AND (T1.Cycle+1=T2.Cycle)
>
> Keep checking to see if we've missed anything else. This
> query is the key to the whole operation of duplicating a
> record and making sure that it doesn't duplicate it more
> than once. So we have to make sure that it does everthing
> correctly, including not doing anything if it has already
> been done.
>
> Let me know if the above changes are an improvement or what
> happens.
>
> --
> Marsh
> MVP [MS Access]
>
- Next message: MN: "Re: text box search form"
- Previous message: Can you post a sample of your code: "RE: Command not available"
- In reply to: Marshall Barton: "Re: Writing Executable VBA Statements"
- Next in thread: Marshall Barton: "Re: Writing Executable VBA Statements"
- Reply: Marshall Barton: "Re: Writing Executable VBA Statements"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|