wilcon
asked on
Searching to a Microsoft Access Dataset using VBA
How do I search through a Microsoft Access Dataset using VBA to find the greatest value
take a look at the max function. Also look at dmax.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Using DMax:
Dim MaxVal as variant
MaxVal = DMax("YourField", "YourTable")
Dim MaxVal as variant
MaxVal = DMax("YourField", "YourTable")
Are really talking about a "DataSet" i.e. a .NET object?
If so, then the following will do the trick
dsMyDataSet.tables("MyTabl e").Defaul tView.Sort = "MyField"
dim dr as datarow = dsMyDataSet.Tables("MyTabl e").DataVi ew.Rows(0)
If so, then the following will do the trick
dsMyDataSet.tables("MyTabl
dim dr as datarow = dsMyDataSet.Tables("MyTabl
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.
Arji,
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.
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 answer....no problem...just curious.