By Richard Rost 18 months ago
Access String Functions: Left, Right, Mid, Len, InStr
In this video I will teach you how to use the string functions in Microsoft Access to make sure users are entering valid part numbers according to a set of rules. We will learn about the Left, Right, Mid, Len, and InStr functions.
Zoe from Great Falls, Montana (a Platinum Member) asks: When placing an order with our primary supplier, we have to make sure the part number is valid. They have a gigantic database of parts, and it changes constantly, so looking up each part number isn't practical. They do, however have a specific format for all of their part numbers. If I could just make sure my users are typing the part numbers in the correct format, that would eliminate 99% of my problems. I import most of this data from Excel sheets, so I can't use an Input Mask. You wouldn't believe the junk I have to correct! Can you help me, please!?
Part Number Rules: Has to start with the letter P. The right 3 characters have to be a number greater than 100. The 5th character has to be a hyphen. The whole string has to be exactly 9 characters long. The letter X must be included somewhere in the string.
Members will learn how to use the string functions in VBA to make sure users are entering in valid passwords. We will learn how to do a binary search (to tell capital from lowercase letters) with Option Compare Binary or StrComp function, and to determine if a string contains ANY character from an allowed list. We'll write our own IsFound function - is any character from string 1 found inside of string 2.
Leon from Bismark, North Dakota (a Gold Member) asks: I created a form allowing my employees to change their password. They must enter their current password and then create a new password, and verify the password by entering it twice. I check that the new password is not the same as the current password. I want to include all the parameters that strengthens the password. I appreciate your help.
Password Rules: The first character has to be a capital letter. The password must contain both capital and lowercase letters, plus at least one numeric digit and one special character: !-_#$@%+
Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the database template from class plus get access to the Code Vault. If you signed up on YouTube you have to register on my YouTube Find User page so I can set up your account here on my web site. If you're not a member, Join Today!
microsoft access, ms access, #msaccess, #microsoftaccess, #help, #howto, #tutorial, #instruction, #learn, #lesson, #training, #database, left, right, mid, len, instr, strcomp, part numbers, change passwords, option compare binary, capital, lowercase, numeric, digits, one string found inside another, isfound, any character found in a string, allowed characters list
Subscribe to String Functions
Get notifications when this page is updated
Check out these other pages that may be of interest to you: