Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Location
    Illinois
    Posts
    14

    MAX problem

    Hello,

    I am using the MAX function to choose a record that has the maximum date or unique identifier. I am using MAX(IDNbr), where IDNbr is an IDENTITY. I am using MAX(ApprDnyDt) which is datetime. Neither of these return one record. In both cases, I still receive all of the records.

    Any ideas?

  2. #2
    StepUP is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Dec 2005
    Posts
    99
    I assume you are talking about a Totals query.

    If you are using ONLY the MAX function, that should work.

    If you have a "Group By" in the query, it won't return just one record.

  3. #3
    Join Date
    Apr 2006
    Location
    Illinois
    Posts
    14
    No, I am not trying to total anything. I am trying to select the record with the latest date or IDENTITY within a key.

  4. #4
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Valeda,

    You probably need something like:

    SELECT KeyField, Max([DateField])
    FROM SomeTable
    GROUP BY KeyField

  5. #5
    Join Date
    Apr 2006
    Location
    Illinois
    Posts
    14
    I ended up creating another query that joined the table to itself. Then I used the results from the query instead to the table. I don't know if it was the best solution, but it worked.

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

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