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:
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.