How to get max value from table (Access 2003 vs 2005)

Posted on 2009-12-20
Last Modified: 2013-11-29
Dear Experts,

i have 1 table (tbl_reg) with 2 fields (reg_no, reg_name) in access 2003.
in 2005, i want to get the max value for reg_no.

pleas help, how to code this?

Question by:oohoo_u
    LVL 51

    Expert Comment

    select max(reg_no) as MaxRegNo from myTable
    LVL 9

    Accepted Solution

    If you want to fetch it after fill to datatable u can use Compute as following

     MessageBox.Show(ds.Tables(0).Compute("MAX(EmpID)", ""))

    Author Closing Comment

    it should be worked

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now