A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

phone textbox default value problem



 
 
Thread Tools Display Modes
  #1  
Old January 5th, 2008, 08:45 PM posted to microsoft.public.access.forms
Arnold Klapheck
external usenet poster
 
Posts: 14
Default phone textbox default value problem

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
  #2  
Old January 5th, 2008, 09:23 PM posted to microsoft.public.access.forms
Beetle
external usenet poster
 
Posts: 1,254
Default phone textbox default value problem

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

--
_________

Sean Bailey


"Arnold Klapheck" wrote:

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

  #3  
Old January 5th, 2008, 09:35 PM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default phone textbox default value problem

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!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200801/1

  #4  
Old January 5th, 2008, 10:30 PM posted to microsoft.public.access.forms
Arnold Klapheck
external usenet poster
 
Posts: 14
Default thank you that works

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.
  #5  
Old January 5th, 2008, 11:05 PM posted to microsoft.public.access.forms
Arnold Klapheck
external usenet poster
 
Posts: 14
Default space at end of default value

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?
  #6  
Old January 6th, 2008, 04:50 AM posted to microsoft.public.access.forms
Linq Adams via AccessMonster.com
external usenet poster
 
Posts: 1,474
Default space at end of default value

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?

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200801/1

  #7  
Old January 6th, 2008, 05:24 AM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default space at end of default value

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



"Arnold Klapheck" wrote in
message ...
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?



  #8  
Old January 6th, 2008, 03:39 PM posted to microsoft.public.access.forms
Arnold Klapheck
external usenet poster
 
Posts: 14
Default Answer: space at end of default value

"Arnold Klapheck" wrote:

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.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:50 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.