DMax()

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I use DMax() in a querie to get the highest no in a recordset and
sore it in a variable?

Gad
 
You shouldn't need to use a query in this case, and, in fact, you should
seriously avoid using any domain aggregrate functions in queries, because
they can be really slow. Since you want to populate a variable, you'll need
to do this in code, so you might as well use VBA code to determine your max.
value as well.

An example that comes to mind of using DMax in VBA code to determine the
next highest number can be found at Roger's Access Library:

http://www.rogersaccesslibrary.com/download3.asp?SampleName=AutonumberProblem.mdb

As long as the criteria field is properly indexed, you should not suffer the
same performance hit that you would if you used a domain aggregrate function
in a query.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Back
Top