Access 2010 Pattern Match

Hi Experts,

I have a field on a form that is Text 7 characters.  The value that must be entered has a pattern of ###.#:1.  e.g. 098.3:1.

The right 2 characters will always be ':1' as this is a ratio.

How do I specify the Pattern Matching (on the form and also using VBA in an Event) to ensure that the left 5 characters are always entered and in the specified format of 3 digits a decimal point and one digit with the right two characters always ':1'.

Thanks,
Bob C.
Bob CollisonSystem ArchitectAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
hi Bob,

You can specify an InputMask for the control (you could also put this in the table design for the field -- but that is not necessary if data will be entered and changed using a form).  This one:
000.0.\1;0;_

specifies 3 numbers then dot then one number then dot then a literal character of "1"
; separates the parts
;0 means that the symbols are stored in the data (the dots and ending "1") -- "0" is the second part of the InputMask
;_ means that underscore will be the place-holder character  -- "_" is the third part of the InputMask

here is a reference link:

TextBox.InputMask Property
https://msdn.microsoft.com/en-us/VBA/Access-VBA/articles/textbox-inputmask-property-access


have an awesome day,
crystal
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob CollisonSystem ArchitectAuthor Commented:
Hi Crystal,

Thanks for the information.  It is what I was looking for.

Thanks,
Bob C.
0
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
you're welcome, Bob ~ happy to help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.