phone textbox default value problem

  • Thread starter Arnold Klapheck
  • Start date
A

Arnold Klapheck

I have a phone field and I have a default area code set and when I tab to the
field the area code is highlighted and I have to click off of it to enter
data. How can I have it so when I tab to the field I can immediatly start
typing the phone number after the area code?

If the area code is different than the default I figure I could just back
space and change it. 90% of the time the default will be correct.

I have the input mask as !\(999") "000\-0000;0;_
and the default value as (916),
I am leaving the formatting info in because I have to import the data and it
has the " ( ) - " in the imported data

any other suggestions would be appreciated,
thnx, Arnold
 
B

Beetle

Use the SelStart property of the control. For example, in the GotFocus event
you would put a line of code like;

Me![PhoneControlName].SelStart = 5

You may want to put this in multiple events like OnClick, GotFocus, etc. to
cover the different ways a user can enter the control.

HTH
 
L

Linq Adams via AccessMonster.com

Beetle Bailey's right on the money! And it does need to be in the OnClick
event as well! For some bizarre reason, when the textbox gets focus by
clicking on it, the GotFocus event doesn't fire!
 
A

Arnold Klapheck

thank you that works great

I found the default input mask puts a space after the area code so you
either have to take the space out of the input maks or add a space after the
default area code and make the code Me![GuCell].SelStart = 6 instead of
a five.
 
A

Arnold Klapheck

The data I am importing has a space between the area code and the number. For
the default value how do you get a space after the area code?
 
L

Linq Adams via AccessMonster.com

After re-reading your posts I find myself more confused than usual! You state
that you're importing your data THEN you speak of entering your phone data!
Is it one or the other or both?
 
J

Jeanette Cunningham

Hi Arnold,
Input masks make life much more difficult for both developer and user as you
have just experienced.
It is much easier in Access to just let the user type in the number (do the
same with dates)
Save each number in the table as a string of numbers, then you want to show
the numbers on a form or report, just include a calculated field in the
query which formats the number the way you want it to appear.
If you wish to change the input mask, open the table with the field that has
the input mask and use the wizard that appears when you click the button
with the ellipsis opposite the property called input mask. You may also be
able to use that same input mask for the format of the textbox control on
the form. I don't use input masks any more so I'm not quite sure how it
works on the form - you could check it out.

Jeanette Cunningham
 
A

Arnold Klapheck

Arnold Klapheck said:
The data I am importing has a space between the area code and the number. For
the default value how do you get a space after the area code?

The answer is you don't need to put a space at the end of you default value,
use code

Me.[TextBoxControlName].SelStart = 5

and put it for events onFocus and Click, then your cursor will be at the
point you need it, ready to start typing.

And yes I import data and I also input some by hand and I need to be able to
export it to a database that has the areacode and phone together.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top