Tip:
Highlight text to annotate it
X
I've made a copy of
ODB12 Dates and Dollar Signs and called this one ODB13-
Pattern-Field I've opened up the form
to show us that we're at the point we left off at the end of the last video
We're going to look at the phone number field
in this video, right now i can type in
anything I want into this field. Here I've got some
letters some numbers and some special characters - I can save it
go to the next record - and when I go back
we see that those letters numbers and special characters
are still in the number field we want to change that
so our formal only except numbers
in this field. To do that we're going to go into edit mode
so I'm going to close this and reopen it in
edit mode what we're going to do
is to remove are phone number text field in replace it
with a pattern field a pattern field will allow us to
only accept numbers in the text box at least for our case
there are times when you may want to have only letters
maybe for a name field or only numbers and letters but no special characters
we can do all that using a pattern field
so I'm going to hold down Control in click on the phone number text box
and delete it. The pattern field is on the "More Controls" toolbar
so I'm going to have to come over to are
more controls Icon on our controls
toolbar the pattern toolbar is a little hand over box
and I'll enter it on to our form
I'm going to right
click on my new text box and click on control to open up the Properties dialog box
we're going to give our field
a new name we're gonna call this ptn-
phone number going over to the data tab
you want to select phone number
going back to the
General tab we want to make this look like
our other text boxes so we're going to make the
border 3D give it a
height of .25 and a background color
of gray 10%. When we add a new field
it is usually puts it to the bottom of our tab order
so, I'm going to come down to our tab order or our activation order
click on that - select our phone number
and move that up just
under our end date. For our new field
we want to put in something called an "Edit Mask". An Edit Mask is just like a
Halloween mask
he will hide certain parts and let other parts show through
just like Halloween mask hides part in the face
but allows another part of the face, like the eyes,
to show through. In our pattern Properties box we want to go up to the top
and we see we've got two fields
with "mask" we've got an "Edit mask" and a "Literal mask" let's start with the "Literal
mask"
I'm going it put in some characters I'm going to put in
a left parenthesis
asterisk, asterisk, asterisk right parenthsis
space underscore
underscore underscore dash underscore
underscore underscore underscore so that's how we want them to type in the
numbers with the underscores
and the asterisks are; and I use two different characters to show that they don't have
to be
all underscores all asterisk you can put in anything you like their
now let's look at the edit mask
for this one I'm going to put in
L N N N
L L N N N
L N N N N
let's take a look at this and see we can figure it out before I bring up the key.
Where I have the Ns is where I want to allow the numbers
Here's the "Edit Mask" Key. If it's an L
This position cannot be edited it will use
what is in the literal mask value
if it's a lower case "a" it can be lower case
or uppercase letter. If it's a upper case "A"
characters a-z (are allows) but they have to be capital
it will convert lower case capital
A lower case "c" is for characters and numbers
and uppercase C
allows characters and numbers but the characters will be capitalized
N this is what we're using - only
numbers 0 - 9. And x is all printable characters, a capital X allows
principal characters but letter will be capitalized. I will put this
letters will be capitalized. I will put this key out on the website in case any of you want to
download it.
So, we know what this is now. Let's see how it works
let's go down to "edit view"
and I need to click off all our objects, let me close
our more controls toolbar
I'm going to put in a number - let's put in
999 I'll try and put in some letters
It does not allow it! 555
1234 our parentheses
have to be there we have our space, and our dash.
All our other values have to be numbers let's go to the next record -
What happens if I take them all out?
We've got our asterisks, and underscores.
If I save this, go to the next record when I come back,
we still see the asterisks and the underscores
Let's see what this looks like on our table. This is record number 9
I'm going to come down to our "Data Source as a Table"
To see record number 9, I'll need to scroll over to see the phone number
we see our edit mask.
So, what we put net edit mask; is going to be our default
Value, let's close our "Data Source"
Go back into "edit mode"
It's a little cleared now. Our "edit mask" tells us what can go in that field
it can only be 14 characters, because that's all I put in here
to our "edit mask"
the only values we can change are the Ns.
The Ls have to be what is down
in are literal mask in that position so that or literal mask works
I'm going to close the Properties dialog box
save the form
close the form, and save our database.