I didn't check the syntax of your whole statement but I'm immediately drawn to the "=max()"
Have you considered using DMax()? If you do that, you should look up the syntax in help. Also, be cautious about where you put calls to functions. Check out the help syntax for OpenForm and I think you'll find you need to put the =DMax(stuff in here) outside of the quotation marks.