There is always, when you have to use an expession of som
heavyness( code lines or execution speed) twice or more, the
possibility of using a temporary variable.
temp = dmax(......)
if not isnull(temp) then ....