Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Report using "Max" command

Discussion in 'Information Technology' started by Roger Bell, Nov 19, 2005.

  1. Roger Bell

    Roger Bell
    Expand Collapse
    Guest

    I have designed a report based on a query which includes, among other fields,
    2 fields call "Amount Pledged" and a field called "countofFrequency". EG of
    entries as follows
    Amount Pledged $100, Frequency 2
    Amount Pledged $200, Frequency 4
    I have created a text box to try and get it to list the Amount Pledged based
    on the Maximum Frequency number, but cannot seem to get the code right. Any
    help would be appreciated.
     
  2. Loading...

    Similar Threads Forum Date
    UK British Sikh Report-2016 Breaking News Mar 24, 2016
    1984 The Story I Did Not Report In ’84 History of Sikhism Jun 28, 2015
    Opinion Top Green Beret Officer Forced to Resign Over Affair With WaPo Reporter Breaking News Jun 26, 2014
    United Sikhs New Report Shows Increasing Hate Attacks on Sikhs Sikh Organisations May 21, 2014
    Legal ACLU reports: Judge orders Sikh man, "Remove that rag, or Go to Jail! Breaking News Sep 27, 2013

  3. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You could create a new query based on that query:

    SELECT TOP 1 [Amount Pledged], countofFrequency
    FROM MyQuery
    ORDER BY countOfFrequency Desc

    Alternatively, you could use:

    SELECT [Amount Pledged], countofFrequency
    FROM MyQuery
    WHERE countofFrequency IN
    (SELECT Max(countofFrequency FROM MyQuery)

    Note that if the highest frequency applies to more than one Amount Pledged,
    both queries will return more than one row.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)



    "Roger Bell" <RogerBell@discussions.microsoft.com> wrote in message
    news:7470ABB9-8B9C-40A0-8305-344BCC427311@microsoft.com...
    >I have designed a report based on a query which includes, among other
    >fields,
    > 2 fields call "Amount Pledged" and a field called "countofFrequency". EG
    > of
    > entries as follows
    > Amount Pledged $100, Frequency 2
    > Amount Pledged $200, Frequency 4
    > I have created a text box to try and get it to list the Amount Pledged
    > based
    > on the Maximum Frequency number, but cannot seem to get the code right.
    > Any
    > help would be appreciated.
     

Share This Page