Results 1 to 3 of 3
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670

    Capture MAX() Value From Table In VBA

    I am using VBA to create a query - I then want to use VBA to get the storeNum with the highest count. For example, this is the query I use to get the counts
    Code:
    SELECT [StoreNum], Count([StoreNum]) AS [CountO]
    FROM data
    GROUP BY [StoreNum]
    ORDER BY Count([data].[StoreNum]) DESC;
    Now my question is, using VBA how can I capture the highest number from this query? Or the MAX() value of [CountO)?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    DLookup("Max(Count0)","queryname")

  3. #3
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    670
    I always forget about the DLookup()

    Thank you

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

Similar Threads

  1. Replies: 1
    Last Post: 09-28-2016, 05:59 PM
  2. Capture a form's Open instance to a table
    By DubCap01 in forum Forms
    Replies: 7
    Last Post: 04-01-2015, 01:26 AM
  3. Replies: 35
    Last Post: 06-17-2013, 11:02 AM
  4. Replies: 1
    Last Post: 05-23-2012, 12:46 PM
  5. Replies: 5
    Last Post: 01-15-2011, 01:35 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