Results 1 to 8 of 8
  1. #1
    copegjc15 is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Posts
    5

    Query Design Question

    Hello all,

    I am trying to run a query in Access 2007 that will return the record that has highest value for a certain field.

    For example, I have the following data:

    Field 1
    Field 2
    Field 3
    Field 4

    In Record #1 I have the following data:

    Field 1 - 10230

    Field 2 - A
    Field 3 - 1
    Field 4 - 75


    In Record #2 I have the following data:

    Field 1 - 10230



    Field 2 - A
    Field 3 - 2
    Field 4 - 23


    In Record #3 I have the following data:

    Field 1 - 10245

    Field 2 - A
    Field 3 - 6
    Field 4 - 33


    When field 1 has the same data, I want my query to display the records where field 4 has the greatest value. So, in the end, this query should display Record #1 (in red) and Record #3 (in blue).

    How would I do this in the query design?

    Any assistance would be greatly appreciated. Thank you for taking the time to read this.

    Greg

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You should be able to adapt this method:

    http://www.baldyweb.com/LastValue.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    copegjc15 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    5
    Thanks, however, I am kind of a newbie here.

    How / Where would I incorporate all of that info as I am using the Query Design method.

    Would I just use the build function, and then use that method and substitute my field names?

  4. #4
    copegjc15 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    5
    Thought I had figured it out...

    Back to the drawing board

  5. #5
    copegjc15 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    You should be able to adapt this method:

    http://www.baldyweb.com/LastValue.htm
    Where in Access would I actually put this code? I am using the basic query design method, and am not too familiar with any type of coding.

    Greg

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    There's no code involved, just 2 queries (what you see on my site is the SQL view of the queries). The first would use your field1 and field4 instead of mine, grouping on 1 and max on 4. You would need to click on the totals button to see those options (looks like a Greek E).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    copegjc15 is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2010
    Posts
    5
    THANKS A LOT!!!

    That worked.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Excellent, glad it worked for you. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Basic design question
    By Brant in forum Access
    Replies: 2
    Last Post: 11-10-2010, 12:37 PM
  2. A basic question about database design
    By guitarbinge in forum Access
    Replies: 2
    Last Post: 11-05-2010, 03:29 PM
  3. Design Question
    By grahamee in forum Access
    Replies: 2
    Last Post: 06-14-2010, 11:13 AM
  4. DB design question
    By dlburkins in forum Database Design
    Replies: 2
    Last Post: 08-28-2009, 07:06 PM
  5. Design Question
    By bdriscoll in forum Database Design
    Replies: 3
    Last Post: 05-03-2009, 08:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums