Searching to a Microsoft Access Dataset using VBA

How do I search through a Microsoft Access Dataset using VBA to find the greatest value
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

take a look at the max function. Also look at dmax.
Try This

These are my Module references From
--> Tools --> References
Visual Basic for applications
Microsoft Access 9.0 Object Library
OLE Automation
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Objects 2.5 Library

Dim myDb As Database
Dim myRs As Recordset

Set myDb = CurrentDb
mySql = "Select Max(yourfieldname) As MaxField From YourTableName"
Set myRs = myDb.OpenRecordset(mySql)
GreatestValue = myRs("MaxField")

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Using DMax:
Dim MaxVal as variant

MaxVal = DMax("YourField", "YourTable")
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Are really talking about a "DataSet"  i.e. a .NET object?

If so, then the following will do the trick

dsMyDataSet.tables("MyTable").DefaultView.Sort = "MyField"
dim dr as datarow = dsMyDataSet.Tables("MyTable").DataView.Rows(0)

Not sure I understand why you would choose to use 6 lines of code and overhead when you can do the same thing with 1 line of code.  That's very inefficient.

I think it was accepted, because it was a complete example.

Im just here to help, if you want the points thats fine with me.
Don't care about the points....just thought it was a little strange.  It is the asker's right to choose whatever answer he wants especially since you answered first and it WAS a correct answer.  I would only object if my answer was first and correct and the asker chose something submitted after my problem...just curious.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.