Ok, two things:
1. The code is in the wrong event.
2. When you create a new record, Contract_no has no value, hence, it's always null. This criteria doesn't even make sense to be there anyway.
Put this in the Default Value property of the textbox.
=Nz(DMax("Application_No","APPLICATIONS"), 0) + 1