Text box appears selected

G

Guest

Thanks in advance!

When I open my Tabbed form in form view, the text in my first text box on
each tab appears selected. If i click in the box, it will unselect, of
course, but if I return to that tab the text appears selected again.

How can I prevent this from happening?

Stilla
 
F

fredg

Thanks in advance!

When I open my Tabbed form in form view, the text in my first text box on
each tab appears selected. If i click in the box, it will unselect, of
course, but if I return to that tab the text appears selected again.

How can I prevent this from happening?

Stilla

Look up the SelStart property in VBA help:
Code the Enter event of the control:

Me![ControlName].SelStart = Len(Me![ControlName])
The cursor will appear at the end of the field.
 
G

Guest

Thanks Fredg! Worked like a charm where there was text in the text box.
HOWEVER, when the text box was empty I get a "Run-Time Error 13: Type
Mismatch"

Any ideas?

fredg said:
Thanks in advance!

When I open my Tabbed form in form view, the text in my first text box on
each tab appears selected. If i click in the box, it will unselect, of
course, but if I return to that tab the text appears selected again.

How can I prevent this from happening?

Stilla

Look up the SelStart property in VBA help:
Code the Enter event of the control:

Me![ControlName].SelStart = Len(Me![ControlName])
The cursor will appear at the end of the field.
 
F

fredg

Thanks Fredg! Worked like a charm where there was text in the text box.
HOWEVER, when the text box was empty I get a "Run-Time Error 13: Type
Mismatch"

Any ideas?

fredg said:
Thanks in advance!

When I open my Tabbed form in form view, the text in my first text box on
each tab appears selected. If i click in the box, it will unselect, of
course, but if I return to that tab the text appears selected again.

How can I prevent this from happening?

Stilla

Look up the SelStart property in VBA help:
Code the Enter event of the control:

Me![ControlName].SelStart = Len(Me![ControlName])
The cursor will appear at the end of the field.

Test for whether there is data in the field first.
Change that code to:

If Not IsNull(Me![ControlName]) then
Me![ControlName].SelStart = Len(Me![ControlName])
End If
 
G

Guest

Thanks! Your last piece of code, plus an "End If" piece at the end did the
trick!!

fredg said:
Thanks Fredg! Worked like a charm where there was text in the text box.
HOWEVER, when the text box was empty I get a "Run-Time Error 13: Type
Mismatch"

Any ideas?

fredg said:
On Mon, 24 Jul 2006 12:34:02 -0700, Stilla wrote:

Thanks in advance!

When I open my Tabbed form in form view, the text in my first text box on
each tab appears selected. If i click in the box, it will unselect, of
course, but if I return to that tab the text appears selected again.

How can I prevent this from happening?

Stilla

Look up the SelStart property in VBA help:
Code the Enter event of the control:

Me![ControlName].SelStart = Len(Me![ControlName])
The cursor will appear at the end of the field.

Test for whether there is data in the field first.
Change that code to:

If Not IsNull(Me![ControlName]) then
Me![ControlName].SelStart = Len(Me![ControlName])
End If
 

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