I have a field in a database for which the input mask should change based on a global variable that I have set elsewhere. How do I set the input mask ensuring that all its characters before the user input (including the variable) are taken as literal?
I’ve tried this:
Me.txtSomeControl.InputMask = varMyVariable & "00000;;*"
But when it comes to runtime, any characters in the variable that are special inputmask characters are taken as special, not literal. Ie if varMyVariable was LLL it would require those characters to be a letter or digit entered, rather than what I intend, which is just LLL in the input mask.
Would I have to split the variable into separate characters and escape each of them or is there an easier way?
You need to put double quotes around any literals in your input mask. The easiest way to do that (IMHO) is to use chr(34) which is the double quote character. So:
Will set the input mask to:
“LLL”000000;;*