Oh dear oh dear.
i do not get any message box, put you code in and aslo tried with square brackets ie: Private Sub complaint_No_BeforeUpdate(Cancel As Integer)
MsgBox DMax("[complaint No]", "[customer contact]")
Me.txtNumberField = DMax("[complaint No]", "[customer contact]") + 1
End Sub...