this is part three of our table series on microsoft access databases and we're going to be looking at input masks now what is an input mask well an input mask is a group of codes that indicate the format of all the values that you want in a field that are valid so for example if there's a specific format for what must go into a particular field and we want to specify that we can use special code to say this is what it must look like so when we talk about these fields there are different options available to us the different codes that you need to know now there's two scenarios with most of the codes for example there's a scenario when they must have that particular value and there's one where it could have that value but it could be black so we have the compulsory option and the optional option so let's take the scenario of a digit if we've got a number any number from naught to nine it takes one digit then we will put a 0 as the compulsory code and a 9 for the optional one so if it's definitely got to be there we put a 0 if it could be there but it could be blank you put in a 9. so if you want a 2 digit number it must either be 10 up until 99 you'll just put two zeros there and that will be a compulsory two digit number but maybe you want a letter to go in a particular place and any letter from h is it then if it's definitely supposed to be there you would use the capital l as the compulsory letter and a question mark if it's an optional which means it could be a letter or it could be blank we don't mind what happens if it could be a letter or a digit in that particular place that particular slot it could be a number or a digit so it could be a or could be three if it's compulsory then we can use the capital a but if it could be blank as well or left out then we're going to leave a small a as the optional letter or digit and what happens if it's any character or space it literally could be anything it could be a question mark it could be a letter it could be a digit if it's compulsory then we're going to want to use the ampersand or what you might refer to as the and symbol but if it's possible to be left blank then we can use the capital c so there are the codes in the beginning there are lots of other codes but that's what we can start off with so in south africa we have license plate numbers and they look something like this they have three letters followed by two numbers followed by two letters at the end and that seems to be the generic format for most of our registration plate for our vehicles i'm not talking about the the personalized ones i'm talking about the generic ones so if we wanted to have an input mask for all generic license plate numbers we know that we're always going to start off with three letters so we're going to use and they're all compulsory so we're going to use that letter l so we're going to have three l's for our input mask it must be ll so that no tells us that there must be three letters in the beginning and this will be followed by three digits so there will there's never a chance for one digit or for two digits it's always three so therefore we're going to have three compulsory digits which means we're going to put three zeros there and this is followed by two compulsory letters it's always two so we're going to put two l's at the end so this would be the input mask for a car registration plate in south africa so there are other options as well available to us so for example if you want all of the characters to be an uppercase then you just put a greater than symbol in front of the letters and they will make anything that's after it will then all letters will be in capitals and for lowercase you can just use smaller than letter smaller and that will make all the letters into smaller than letters if you want to display a bunch of text literally like it is and especially if it's it's part of the code let's say you wanted to say a b c or a m at the end of a time for example um and you didn't want that a to be confused with the input mask code a then you could use quotation marks around the am and it will display the aim as is but if you want to display one character literally you could just use the slash um for that so whatever's after that slash will be literally displayed literally as it is so if you put slash l it won't be the code l it'll just be the actual character l so knowing that if you remember our license plate number we had ll-000ll but in south africa they all have to be capital letters so to adapt to this input mask to make sure it's even better to make sure that take into consideration that the letters must be capital then we're going to put a greater than symbol in front of it and that means all the letters that follow it will be in capital letters so let's have a look at some input models so when you click let's say we've got car registration we want to put an input mask on that so when i click on car registration you'll see there's an input mask area now you can click on the little ellipse there and it'll take you through a wizard where you can add different uh input marks so you can actually have some default ones that are already set for you or you can set your own so we said it must be ll followed by zero zero zero followed by ll so that's what the input mask that we said originally and so what happens if i come to the actual datasheet view once we've saved you'll see when i click on car registration over here you'll see these input holders so i'm going to type in numbers now and you'll see nothing happens i'm typing numbers on my keyboard i don't know if you can hear it but i'm typing numbers nothing's happening because the first three characters have to be letters so i'm going to start adding letters so i'll just add some letters and i'm going to keep on typing letters and nothing's happening why because the next we have to be numbers so i'm going to shift to numbers i'm going to add some numbers and i'm going to keep adding numbers nothing's happening nothing's happening why because we've got to be at the place where we need to add letters so let me go back to the letters and there we go and it doesn't allow me to add anything else see it's already put the spaces in for me as well but it doesn't allow me to put anything else in here just that format okay so that's a nice little feature to make sure that people put it the values in the correct format now if i go back here and i put in you see i put the the literal mark for the slash i mean for the for the space so that the spaces are as is if i put a greater than symbol in front of it now and i go back to my table you'll see that it's all in capital so now although my caps lock is off and i'm not pressing shift if i type in letters it's going to automatically put them in capitals so that's how the capitals work okay so that's a good example of the input mask for a car registration i'm just going to do some random ones if we if we had contact number here let's say we always wanted the contact number to be ten digits so it could be zero zero zero space zero zero zero space zero zero zero zero now i know some countries they had ten numbers in their cell phone numbers and then they added another one because they ran out so they went so the last one for example in this case you could have 10 but you could have 11. so the last digit could be optional so in that case the optional digit was the 9. so in that case you have you could have 10 numbers or you could have 11. so you could have that particular scenario so if i go to this particular scenario boom and i go to contact number and i type in just three numbers and i click away it's it's not it's not done yet we've got to finish it so type in three more still not done now if i put in four and i leave the last one blank you see it accepts it now or i could put i'm typing letters nothing but if i type in another number it accepts that as also another option so that's how you get the optional digits and you could have something like a special code maybe there's a code that you need and the code is it's one letter followed by maybe another letter followed by one number followed by maybe another number so a one could be one or a b one could be one or a b seventeen could be one or a seventeen could be one those are the different options well in that case you've got a compulsory letter followed by an optional letter followed by a compulsory number followed by an optional number so you could have that particular input mask over there and so for that you can type in if we save it and we come here to code i can type in l now i would wouldn't put a noun there because that's the space for a character so space nine so if i click l9 that's a valid option or i can say l n okay that's a valid option or l93 that's a better option or l 93 oh no no we want the l but we don't want the n so delete the end put the l or l 9 3 that's also a valid option so those are the different types of input masks that you could get so there we go those are input box and just so we know while we are on input masks um you saw that the code for capsulated is great then and the the small lattice is less than you can actually do that on format as well you can put a greater than symbol on format so let's take a driver name if i put a greater than symbol on format you'll notice it doesn't matter what our type in the driver's name it will always be capital letters when i click away it changes it to capitals and if i go to it and i change it to a less than symbol it doesn't matter what i type um it'll make it smaller so if i make a caps lock and make it all calculators and i click away it'll convert it to small letters for me so those are options for the format so you use the input mask codes for that as well for just those two though okay so there we go those are input masks for other videos in this video series go to our youtube channel click on the subscribe button click on the like button we'd love to hear from you so leave a comment and remember don't do it the long way do it the mr long way