Re: Writing Executable VBA Statements

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Marshall Barton (marshbarton_at_wowway.com)
Date: 02/10/05


Date: Wed, 09 Feb 2005 22:21:57 -0600

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]


Relevant Pages

  • Re: Pep 3105: the end of print?
    ... No, but it doesn't matter. ... There's no particular reason why you have to ... that is capable of duplicating the functionality of print, ... Edward K. Ream email: edreamleo@xxxxxxxxxxx ...
    (comp.lang.python)
  • Re: The infintely small number b
    ... This is "ex cathedra". ... You give no reason that an interval ... argument having to do with cutting and hence "duplicating" points, ... but you backed off that when it was pointed out that saying ...
    (sci.math)
  • Re: Accept Tentative Decline buttons grayed out
    ... of duplicating the event on my iPhone as well. ... You need to first determine which, if either, of the causes I suggested is the reason. ... Entourage Help Blog ...
    (microsoft.public.mac.office.entourage)
  • Duplication of Tables
    ... I have put together a database, with mulitple tables. ... For some reason MS Acces, are duplicating ...
    (comp.databases.ms-access)