Enter time field at leftmost position

G

Guest

I am hoping someone can help. I have a time field on my form and when
tabbing through fields it is easily editable but when the field is clicked
into the cursor remains at that position which isn't necessarily the correct
position nor easily editable (you have to highlight the whole field and enter
again). Is there a way to enter the field in the left most poistion (on
entry) or in edit mode to overwrite the field?

These discussions groups have been a great help!

Thanks,
Terri
 
R

RoyVidar

Terri said:
I am hoping someone can help. I have a time field on my form and
when tabbing through fields it is easily editable but when the field
is clicked into the cursor remains at that position which isn't
necessarily the correct position nor easily editable (you have to
highlight the whole field and enter again). Is there a way to enter
the field in the left most poistion (on entry) or in edit mode to
overwrite the field?

These discussions groups have been a great help!

Thanks,
Terri

I think, if you try the on mouse up event, and set selstart to the
beginning of the control.

Me!txtMyTime.SelStart = 0

Or, if you wish to select it,

Me!txtMyTime.SelStart = 0
Me!txtMyTime.SelLength = len(Me!txtMyTime.Value)
 
G

Guest

I think the GotFocus event may be a better choice. It will position the
cursor regardless of whether the user gets there with the mouse or the Tab
key.
 
G

Guest

Thanks for the advice. I think that the GotFocus event sounds better but for
some reason neither one will work. I keep getting a message that Access
can't find the macro '
..' ?? Any ides? Thanks.
 
R

RoyVidar

Terri said:
Thanks for the advice. I think that the GotFocus event sounds better
but for some reason neither one will work. I keep getting a message
that Access can't find the macro '
.' ?? Any ides? Thanks.

I think it can be a lot of things, ranging from stuffing a period "."
in the one of the event propertis that is called, to form corruption.

Perhaps post the excact code you are using, and in which event, and
check if there are something other than a valid macro name or
[event procedure] in the event tab for the form or controls you've
just manipulated with - do also look for something as small as a
period.

I still vote for the mouse up event, because I think the controls
gotfocus event occurs before the control receives the mouseclick,
and that the mouseclick will remove the selection, when received.
 
G

Guest

Where did you put the code? If you put it directly into the Got Focus text
box in the control's Properties dialog, it won't work. It needs to be in the
form's module.

To do that,
delete the code in the text box.
Click the command button with the ... to the right of the text box. a dialog
will pop up offering Expression Builder, Macro Buildder, and Code Builder
options. Select Code builder.

The VBA editor will open with your cursor in the sub for the event. Put the
code there.
 
G

Guest

I tried a number of different things and finally removed all instances of the
entry and recreated the control. It is working now. Thank you very much!
 

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