|
||||||
|
|
Input Masks Varying Length By Richard Rost Create Input Masks of Variable Length In this Microsoft Access TechHelp tutorial, I'll show you how to enter Input Masks of varying length. MembersThere is no Extended Cut for this video. LinksInput Masks: https://599cd.com/InputMask
IntroIn this video, we will talk about how to set up input masks in Microsoft Access to handle phone numbers or other fields where the length may vary, such as accepting both seven- and eight-digit numbers after the area code. We'll cover the difference between required and optional input mask characters, show how to build an input mask that allows for an extra digit, and discuss best practices for storing phone numbers as text fields in your Access tables.TranscriptWelcome to another TechHelp video brought to you by AccessLearningZone.com. I am your instructor, Richard Rost.In today's lesson, we are going to talk about input masks, and more specifically, how to create an input mask to enter values with different lengths. Today's question comes from Muhammad. He says, in my country, our cell phone number is usually with a three-character header and seven following digits, but now some of the country is using the three-character header, which here in the US we call an area code, with eight following digits. When I set the cell phone text box with an input mask for seven digits, it will not allow the use of eight, but when I set it for eight, it will not allow the use for seven. So how can I set it to accept both? When you are dealing with phone numbers, I always talk in my beginner class about always storing phone numbers in a text field. Do not use number fields. If you are going to be doing math on a value - adding, subtracting, taking a sum, an average, and so on - then yes, use a number field. But for things that you are not going to be doing calculations on, store them as text. However, even being stored as text, you might still want to force the user to enter the value as a digit - zero through nine. Now, with input masks, there are two types of codes you can use: there is a zero and there is a nine. Zero says the user must enter a digit. Nine says the user can enter a digit - it is optional. So here is how this would work in your case, Muhammad. Here, I have got my basic customer table: first name, last name, and so on. Over here, I have got a phone number field. Now my phone number field has no formatting on it - no formatting and no input mask - so people can put in whatever they want, any number of digits, characters, whatever. Let's clean this up; let's get rid of these here. First of all, before you put an input mask on, make sure all the data in your field meets the format that you want, or also get errors, or put it on a brand new, blank field. Here I have got my - in the US, it is a three-digit area code followed by a seven-digit number. Let's say, just like your country, in the US here they decided to add a random eighth digit on the end there. It is optional, you can have it or not. How would I adjust my input mask? I do not have one right now - let's put one on. Normally, for my input mask under the phone number field, I would come down here under input mask and go 000-000-0000. Now, the zeros say you have to put in that digit. You have to put a digit there. As soon as I press enter or tab, notice I get this backslash space. The backslash simply means that the next character will be displayed literally. In other words, it says display that dash. Otherwise, it does not affect the input. Now, this forces me into that format there. However, if I put a nine on the end, now I can optionally put an eighth character there for the phone number portion. Alright: three-digit area code, three-digit prefix, and a four or five-digit suffix there. So now, if I save this and go back to datasheet view, if I come over here these are all formatted properly, and I can now optionally put another character on the end there if I want to. I do not have to. See how that works? If you look at Microsoft's website, you will see all the different options here for the input mask. For example, you can do the same thing with letters: user must enter a letter or digit; user can enter a letter or digit. Here is the same thing with just letters: user must enter a letter; user can enter a letter. The 'must' and 'can' have two different options. I cover lots more about input masks in my Access Beginner Level 3 class, which Muhammad was actually taking. You can find out all the information here about input masks, and each one of my classes has a forum where you can post questions, and this is where Muhammad put his questions. So you can take my classes and ask questions right in there. Of course, I said, "Great question. I am going to make a video," which I am doing right now. I will put a link to this class in the description below the video if you are interested in taking it. Before you take Level 3, however, watch my Level 1 class, which is absolutely free on my website and on YouTube. It is a three-hour tutorial that covers all the basics. If you like Level 1, you can get Level 2 for just one dollar. If you sign up for this, there is an option to get Level 3 for 50 percent off, so that is a great deal. Thanks for watching. I hope you learned something today. Make sure you subscribe to my channel if you are watching me on YouTube. Make sure to click the subscribe button and then hit the little bell icon so you get notifications whenever I release new classes. If you are watching on my website, make sure you subscribe to my Access Forum. Just click the big red subscribe button. If you have questions like this you want to see answered in a TechHelp video, visit my TechHelp page. That is all for today, folks. Thanks for watching. Hope you learned something. We will see you next time. QuizQ1. Why does Richard suggest storing phone numbers in a text field instead of a number field?A. Because you need to perform calculations on them B. Because phone numbers might include letters C. Because phone numbers are not used for calculations and may contain formatting characters D. Because text fields can hold more data than number fields Q2. What does the zero (0) character do in an Access input mask? A. It makes entry of digits optional B. It requires the input of a digit in that position C. It allows letters or digits to be entered D. It skips that position in the mask Q3. What does the nine (9) character do in an Access input mask? A. It requires the input of a digit B. It allows only letters to be entered C. It makes entering a digit in that position optional D. It ignores user entry at that position Q4. How should the input mask be set to allow both seven-digit and eight-digit phone numbers after the area code? A. Use only zeros for all digits B. Use zeros for required digits, ending with a nine for the optional digit C. Use nines for all digits in the mask D. Use only letters in the mask Q5. What should you do before applying an input mask to an existing phone number field? A. Make sure all data matches the input mask format or start with a blank field B. Delete all data in the field C. Set the field to number type D. Merge all phone numbers into one Q6. In an Access input mask, what does the backslash (\\) do? A. It inserts a blank space in the input B. It allows optional entry at that position C. It displays the next character literally D. It skips the next position Q7. Where can you find more information about input masks, as mentioned in the video? A. Only in the Level 1 course B. Only on YouTube C. In the Access Beginner Level 3 class and on Microsoft's website D. Nowhere; it is not covered further Q8. What advantage is provided by using an input mask on a phone number field? A. It prevents any entry into the field B. It forces the input to follow a consistent format C. It allows any length and any characters D. It performs mathematical calculations automatically Q9. Why is it important to subscribe or join the Access Forum, as suggested by Richard? A. To receive notifications of new classes and ask questions B. To get free software C. To download Richard's database D. To access advanced password protection Answers: 1-C; 2-B; 3-C; 4-B; 5-A; 6-C; 7-C; 8-B; 9-A DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks. SummaryToday's video from Access Learning Zone focuses on input masks in Microsoft Access, specifically on how to create an input mask that accepts values with different lengths in a phone number field. This question comes from a student who explained that, in his country, some phone numbers have a three-character area code and seven digits, while others have eight digits after the area code.When you set up a phone number input mask for seven digits, it will reject eight-digit numbers, and vice versa. So, the challenge is finding a way to allow both formats in the same field. Whenever I talk about storing phone numbers, I always stress the importance of using a text field rather than a number field. The only time you should use a number field is when you intend to perform mathematical operations, like sum or average. For phone numbers, which you never add or subtract, text is the better choice, even if it's all digits. Input masks are useful because they let you control the way users enter data. There are two main codes used in input masks: zero and nine. The zero means the user must enter a digit, while the nine allows the user to optionally enter a digit. To illustrate this, I have a customer table with a phone number field that, by default, has no formatting or input mask. This means users can enter any characters in any form. Before applying an input mask, it's important to make sure your existing data fits the format you want, or apply it to a new, blank field to avoid data errors. For example, in the typical US format, phone numbers consist of a three-digit area code followed by a seven-digit number. If an additional optional eighth digit gets introduced, you need to update your input mask accordingly. Normally, the mask would be set to require exactly ten digits, something like 000-000-0000, where each zero forces the user to enter a digit. Dashes or other literal characters are included in the mask so that only numbers get entered where needed. To allow for an optional eighth digit, you add a nine at the end of the mask. This way, the first part remains fixed (three-digit area code and seven digits), but users can enter an eighth digit at the end if they need to. The nine makes the last digit optional, so the field accepts both seven and eight digits after the area code. Microsoft's documentation lists other options as well. You can also set input masks to require letters, or allow either letters or digits, with the difference between required and optional characters defined by various mask symbols. I go into a lot more detail about the various mask options and their uses in my Access Beginner Level 3 class, which was the class the student was taking when he asked this question. If you have your own questions, each of my classes features a forum for student questions. This is the best place to post questions, and I frequently choose interesting topics from these forums for new video tutorials. If you are interested in learning more about Access and input masks, you can find my Level 1 class for free on my website and on YouTube. This introductory course covers all the basics of Access. If you find Level 1 useful, you can pick up Level 2 for just one dollar, and there are discounts available for Level 3 if you decide to continue. As always, if you are watching this on YouTube, be sure to subscribe to my channel and turn on notifications to stay updated with my latest classes. If you are on my website, sign up for my Access Forum for even more tips and community support. If you have questions for a future TechHelp video, visit my TechHelp page to get in touch. You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends. Topic ListCreating input masks for variable-length phone numbersUsing 0s and 9s in Access input masks Formatting phone number fields as text Applying optional digits in input masks Updating existing data to match new input masks Implementing input masks in Access tables |
||||
|
| |||
| Keywords: TechHelp Access input masks variable length varying length PermaLink Input Masks Varying Length in Microsoft Access |