IIf can't be used in VBA code blocks. You'll need to use VBA for that. Here's the code you want:
IF txtInvoiceNumber <> "final" Then
msgbox("text here")
END IF
If you're trying to do this in a control's Datasource property, then, yes, use IIf:
IIf ("final","text...