I give up I think on trapping the error message that comes up with an incorrect entry for an input mask. However, I decided to try not setting the imput mask property in the properties box but to use an If statement in code to check for it. For instance, I have a field called Cashier_No and I want the input mask to be 00009 so that the first 4 entries are required and must be numerical and the last entry is optional but must also be numerical. So, in code I say
if cashier_no.inputmask<>00009 then
msgbox "blah blah blah"
cashier_no.setfocus
However, I can not seem to get a good event to put this code into. I tried OnExit, OnBeforeUpdate, OnAfterUpdate, OnLostFocus and it gives the message but ignores the setfocus statement which allows the user to bypass the field anyway - any suggestions???
if cashier_no.inputmask<>00009 then
msgbox "blah blah blah"
cashier_no.setfocus
However, I can not seem to get a good event to put this code into. I tried OnExit, OnBeforeUpdate, OnAfterUpdate, OnLostFocus and it gives the message but ignores the setfocus statement which allows the user to bypass the field anyway - any suggestions???