For example one textbox on the form should only be numbers and I therefore want to restrict the user to typing in a two digit code like 02 or 72 (not for calculations).Another textbox I only want to allow the user to input 6 characters in the format letter, four numbers and a letter. To select a range of text in the text box, you can use the Select method.You may want to prevent users from saving Microsoft Access records with missing information, especially if this data is important.
This way you can cancel the saving or adding of a record with missing info. Set Focus Cancel = True Exit For End If End If Next End Sub Now in the Microsoft Access form, and for the property of each text box we would like to validate against being empty, we need to type in an asterisk (*) into the Tag property.
I want to check what the user is writing in a textbox before I save it in a database. I guess I can always write some ifs or some try-catch blocks, but I was wondering if there's a better method.
I've read something about Validating Events, but I am not sure how can I use them. Validating Event When you change the focus by using the keyboard (TAB, SHIFT TAB, and so on), by calling the Select or Select Next Control methods, or by setting the Container Control.
This control has additional functionality that is not found in the standard Windows text box control, including multiline editing and password character masking.
Typically, a until the cursor (caret) is within the visible region of the control, you can use the Scroll To Caret method.
For more information, see the WM_KILLFOCUS topic in the "Keyboard Input Reference" section, and the "Message Deadlocks" section of the "About Messages and Message Queues" topic in the MSDN library at