If the name of the table is 'Order', the following should work:
If IsNull(Me.orderno) Then
Me.orderno = Nz(DMax("[Order No]", "Order"), 0) + 1
End If
A few other comments:
Date
is a reserved word and should not be used as a field name, so best to change it to avoid problems. http://office.microsoft.com/en-us/access-help/access-2007-reserved-words-and-symbols-HA010030643.aspxIt is also poor practice to use spaces in field names.
The problems here were quite obvious, however, for future reference, you should state what error you are receiving and which line it occurs on. 'Not working' does not provide any clues.
Add the line DoCmd.RunCommand acCmdSaveRecord at the end, to insure that the record is saved. Make sure that the code is actually running and that orderno is bound to the field orderno. If it still doesn't appear to work, step through he code to see what is happening. As for the comment about autonumber, and autonumber is fine if you don't care about gaps in the numbering sequence, which will eventually occur using an autonumber.