I have some fields in my database that have input masks. If a user enters something that doesn’t follow the mask, they get an error. Using error handling in VBA, I created a message box. But I also want to clear the field to make it easier for the user to reenter an item and/or leave the field (which will also prevent the form from crashing). For the short text, I cleared it using txtPhoneNumber = “”.
However, I haven’t had any luck with the Date and Number format.
I tried txtDate = #1/1/1900# and got the “The macro or function set to BeforeUpdate…” error (I don’t have a BeforeUpdate event); and the DoCmd.RunCommand Undo.
Does anyone have any ideas/or suggestions on how I can clear a field on error?
Thanks!