Where the cursor starts after clicking no a text box

1

1genxer

Hello,

I have tried looking through the other threads but have not seen the answer
to my question. Hopefully someone can help with this today.
I have a simple form I made for a table to collect customer info for a
mailing list. This form is used like a kiosk at trade shows. Anyway, when you
click on any fields that are numbers such as zip codes or phone numbers, the
cursor starts in the text box where you clicked. Is there a way to make the
cursor start on the left side no matter where the user clicked? Please help
ASAP as I have a show tomorrow and am pulling out my hair trying to find an
answer. Thanks!

P.S. I tried clicking on the text to be left aligned in the properties but
that doesn't help. And just for the record, the text fields do not have this
problem, just number fields.
 
N

nlburgess via AccessMonster.com

In the on click event of the field insert the code

Me![VariableName].SelStart = 0

with VariableName being whatever you named your text box.
 
1

1genxer

I was all excited, but it didn't work I am getting an error. It says: "The
expression On Click you entered as the event property setting produced the
following error: The Object doesn't contain the Automation object 'Me'.

nlburgess via AccessMonster.com said:
In the on click event of the field insert the code

Me![VariableName].SelStart = 0

with VariableName being whatever you named your text box.
Hello,

I have tried looking through the other threads but have not seen the answer
to my question. Hopefully someone can help with this today.
I have a simple form I made for a table to collect customer info for a
mailing list. This form is used like a kiosk at trade shows. Anyway, when you
click on any fields that are numbers such as zip codes or phone numbers, the
cursor starts in the text box where you clicked. Is there a way to make the
cursor start on the left side no matter where the user clicked? Please help
ASAP as I have a show tomorrow and am pulling out my hair trying to find an
answer. Thanks!

P.S. I tried clicking on the text to be left aligned in the properties but
that doesn't help. And just for the record, the text fields do not have this
problem, just number fields.
 
R

Ron2006

The cause of the problem is that the field has a formating mask

IF you can live without that preformating then you can take it out and
it will act like most other fields.

Ron
 
K

Klatuu

First, it is NOT a variable, it is a control. Second, the click event will
not fire every time you enter the control. The code should be in the
GotFocus Event.
--
Dave Hargis, Microsoft Access MVP


nlburgess via AccessMonster.com said:
In the on click event of the field insert the code

Me![VariableName].SelStart = 0

with VariableName being whatever you named your text box.
Hello,

I have tried looking through the other threads but have not seen the answer
to my question. Hopefully someone can help with this today.
I have a simple form I made for a table to collect customer info for a
mailing list. This form is used like a kiosk at trade shows. Anyway, when you
click on any fields that are numbers such as zip codes or phone numbers, the
cursor starts in the text box where you clicked. Is there a way to make the
cursor start on the left side no matter where the user clicked? Please help
ASAP as I have a show tomorrow and am pulling out my hair trying to find an
answer. Thanks!

P.S. I tried clicking on the text to be left aligned in the properties but
that doesn't help. And just for the record, the text fields do not have this
problem, just number fields.
 
L

Linq Adams via AccessMonster.com

"What exactly is a "formating mask" and "preformating?"

Neither formatting nor an Input Mask (I assume this is what Ron means) will
keep .SelStart = 0 from working! The problem, I think, is revealed in the
OP's line

"fields that are numbers such as zip codes or phone numbers"

In fields that are defined as numbers (numerical) the cursor starts from the
right side of the textbox, not the left as it would for a text field. So
using

..SelStart = 0

moves the cursor to the beginning of the textbox, in this case the right side!


The real trouble is that things like telephone "numbers" and Social Security
"numbers" aren't really numbers, and shouldn't be defined as such in the
underlying table! They are text that just happens to be made up entirely of
digits! If you change their datatype to text, the Input Mask and the .
SelStart = 0 both will work.

Only data that is has the possibility of being used in mathematical
calculations should be defined as numerical. Obviously, you would never use
telephone "numbers" or Social Security "numbers" to do math with!

BTW, the .SelStart should always be used when using an Input Mask, otherwise
your data entry people who use the mouse to navigate are apt to waste a lot
of time.

Linq

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
R

Ron2006

"What exactly is a "formating mask" and "preformating?"

Neither formatting nor an Input Mask (I assume this is what Ron means) will
keep .SelStart = 0 from working! The problem, I think, is revealed in the
OP's line

"fields that are numbers such as zip codes or phone numbers"

In fields that are defined as numbers (numerical) the cursor starts from the
right side of the textbox, not the left as it would for a text field. So
using

.SelStart = 0

moves the cursor to the beginning of the textbox, in this case the right side!

The real trouble is that things like telephone "numbers" and Social Security
"numbers" aren't really numbers, and shouldn't be defined as such in the
underlying table! They are text that just happens to be made up entirely of
digits! If you change their datatype to text, the Input Mask and the .
SelStart = 0 both will work.

Only data that is has the possibility of being used in mathematical
calculations should be defined as numerical. Obviously, you would never use
telephone "numbers" or Social Security "numbers" to do math with!

BTW, the .SelStart should always be used when using an Input Mask, otherwise
your data entry people who use the mouse to navigate are apt to waste a lot
of time.  

Linq

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200801/1

The property I was looking for was "Input Mask" which can be in the
table definition and/or the form field definition.

The input mask will cause the cursor to stop at the place where the
mouse enters.

Now as to why the SelStart is not overriding that I have NO IDEA. I
was just attempting to give an alternate though less stylistic way of
getting around the problem AND also an explanation of why the
"problem" was there originally.

Ron
 
1

1genxer

Well I tried getting the code into the Got Focus event and I got the same
error. Any other suggestions? I can always just remove the masks, but really
with the phone numbers I need area codes and people don't always put them in
if not prompted.

Klatuu said:
First, it is NOT a variable, it is a control. Second, the click event will
not fire every time you enter the control. The code should be in the
GotFocus Event.
--
Dave Hargis, Microsoft Access MVP


nlburgess via AccessMonster.com said:
In the on click event of the field insert the code

Me![VariableName].SelStart = 0

with VariableName being whatever you named your text box.
Hello,

I have tried looking through the other threads but have not seen the answer
to my question. Hopefully someone can help with this today.
I have a simple form I made for a table to collect customer info for a
mailing list. This form is used like a kiosk at trade shows. Anyway, when you
click on any fields that are numbers such as zip codes or phone numbers, the
cursor starts in the text box where you clicked. Is there a way to make the
cursor start on the left side no matter where the user clicked? Please help
ASAP as I have a show tomorrow and am pulling out my hair trying to find an
answer. Thanks!

P.S. I tried clicking on the text to be left aligned in the properties but
that doesn't help. And just for the record, the text fields do not have this
problem, just number fields.
 
K

Klatuu

There is a known bug with SP3 that causes problems with formats in controls.
Try removing the formatting and input mask and see if it works.
--
Dave Hargis, Microsoft Access MVP


1genxer said:
Well I tried getting the code into the Got Focus event and I got the same
error. Any other suggestions? I can always just remove the masks, but really
with the phone numbers I need area codes and people don't always put them in
if not prompted.

Klatuu said:
First, it is NOT a variable, it is a control. Second, the click event will
not fire every time you enter the control. The code should be in the
GotFocus Event.
--
Dave Hargis, Microsoft Access MVP


nlburgess via AccessMonster.com said:
In the on click event of the field insert the code

Me![VariableName].SelStart = 0

with VariableName being whatever you named your text box.

1genxer wrote:
Hello,

I have tried looking through the other threads but have not seen the answer
to my question. Hopefully someone can help with this today.
I have a simple form I made for a table to collect customer info for a
mailing list. This form is used like a kiosk at trade shows. Anyway, when you
click on any fields that are numbers such as zip codes or phone numbers, the
cursor starts in the text box where you clicked. Is there a way to make the
cursor start on the left side no matter where the user clicked? Please help
ASAP as I have a show tomorrow and am pulling out my hair trying to find an
answer. Thanks!

P.S. I tried clicking on the text to be left aligned in the properties but
that doesn't help. And just for the record, the text fields do not have this
problem, just number fields.
 
L

Linq Adams via AccessMonster.com

Klatuu:

"Second, the click event will not fire every time you enter the control. The
code should be in the GotFocus Event."

Actually, you right and you're wrong, Klatuu! Placing the code in the
GotFocus event will have no effect when the textbox is entered by way of
clicking with the mouse! It doesn't make a lot of dince, but we're talking
about Access here! I know this because I've been using this type of code
since ACC2000. It does have to be placed in GotFocus as well, ***unless*** in
Options.- Keyboard - Behavior Entering Field the option is set to "Go to
start of field."

As I stated earlier, I think his problem is because the fields are numerical,
and so the "start" of the field is the right hand side of the textbox, not
the left hand side, as it is for text fields.

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
L

Linq Adams via AccessMonster.com

Wish we could edit here! Meant to emphasize that the last part

"As I stated earlier, I think his problem is because the fields are numerical,

and so the "start" of the field is the right hand side of the textbox, not
the left hand side, as it is for text fields."

is just a guess! Perhaps it is an SP3 gotcha! God knows there are plenty of
them out there!

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
K

Klatuu

Placing the code in the
GotFocus event will have no effect when the textbox is entered by way of
clicking with the mouse

Sorry, that is not correct. I just did a test on that and clicking in the
text box does fire the Got Focus event.
 
L

Linq Adams via AccessMonster.com

What version of Access are you running? It certainly doesn't in
Access2000/2003! Select a textbox and place this code behind it:

Private Sub TextBoxName_GotFocus()
MsgBox "Clicking caused GotFocus to fire!"
End Sub

Run the form and click on the textbox; no messagebox appears!

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 
D

Douglas J. Steele

I can't comment on what version Dave's using, but I get the message box in
Access 97.

You sure the text box's On Got Focus property is set to [Event Procedure]?
 
K

Klatuu

Access 2003 SP3, XP Pro.
When I said I had tested it, that is exactly what I did. The message box
appears when I click on the text box.
 
K

Klatuu

Access 2003 SP3, XP Pro.

I have used a simiar technique since Ac97 and the GotFocus always fires when
you click on the text box.
--
Dave Hargis, Microsoft Access MVP


Douglas J. Steele said:
I can't comment on what version Dave's using, but I get the message box in
Access 97.

You sure the text box's On Got Focus property is set to [Event Procedure]?

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Linq Adams via AccessMonster.com said:
What version of Access are you running? It certainly doesn't in
Access2000/2003! Select a textbox and place this code behind it:

Private Sub TextBoxName_GotFocus()
MsgBox "Clicking caused GotFocus to fire!"
End Sub

Run the form and click on the textbox; no messagebox appears!
 
L

Linq Adams via AccessMonster.com

Curiouser and curiouser!

"You sure the text box's On Got Focus property is set to [Event Procedure]?"

Yes, I always go to the code window thru the Property Box for whatever event
I'm coding, so it's set to [Event Procedure].

Also, I just went back and ran up a form from scratch, placed a textbox on it,
and did the same thing as above, with the same (for me) negative results.
GotFocus didn't fire.

Actually, I did all of this TWICE! Once on my box, running Access 2003, and I
had a friend here with a laptop running Access 2000, same results on his
machine!

As John Walton use to say "Life's a mystery!"

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

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
 

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