need help with area code telephone number field.

  • Thread starter Thread starter Iwilfix
  • Start date Start date
I

Iwilfix

the area codes in my telephone field will always be the same.
is it possible for it to automaticly enter.
I have tried changingthe input mask. and it seems to work while
entering data directly to the table.
but not if i enter data onto the form.
any help is always greatly appreciated
thanks, Jeff V
 
Check you input mask on the form and change it to match the input mask of
your table ... and STOP entering data directly into your tables <grin> ...
seriously, entering data into tables is one of the major sins in Access, as
no error trapping takes place and you can easily create junk data without
realizing it ...
 
Thank you scott, I will try your suggestion.
And I do know about not entering the data
directly into the tables. But as I am a complete rookie in Access, and
incredibly
stubborn, I am doing allot of experimenting and trying out. BUT will always
heed all
sugestions, reccomendations, and warnings. Again thank you for the help.
Jeff V.
 
the area codes in my telephone field will always be the same.
is it possible for it to automaticly enter.

Jeff, you can do this, but you need a little bit of VBA code in the
Form in which you're entering the data (you can't do this in a table
datasheet at all, no usable events).

Here's the code I use:

Private Sub txtPhone_GotFocus()
Me!txtPhone.SelStart = 6
Me!txtPhone.SelLength = 8
End Sub

Set the Default property of the textbox to

"(208) "

using your own area code of course, to fill in the area code; the
GotFocus event will automatically select the rest of the field. You
can manually go back and edit the area code if it's different.
 
Create an Area code field and set the default value to
your desired area code. Do this in the table design
view's lower pane.
 
Back
Top