How trigger a click on a text box when the form opens

I have a form that opens and a text box is the focus.  But I want to somehow trigger or force a click on that text box.  What would the code be for doing this?
SteveL13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

Do you want to change the selection?

Private Sub Form_Open()
    Me.txtMyBox.SetFocus
    Me.txtMyBox.SelStart = 0
    Me.txtMyBox.SelLength = 0
End Sub
'EDIT OR
'Do you mean?
Private Sub Form_Open()
    txtMyBox_Click
End Sub

Regards
0
Jeffrey CoachmanMIS LiasonCommented:
I think he first expert has your sluton...
If not, then pleas clearly define "Trigger/Force a click"
...You want to force a user to click the box?
If the textbox has the focus, then programmatically, ...it has been "clicked".
0
SteveL13Author Commented:
No.  I just want to force a click on the textbox.  (simulate a click on it).

I have other code firing if the textbox is clicked.  I just want it to be clicked without manually having to click it.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PatHartmanCommented:
You need to better define when you want this to happen.
Do you want it to happen only ONCE when a form opens or do you want it to happen each time the user navigates to a new record?  Or do you want it to happen for only certain records?

Rather than trying to force a click in a checkbox, just run the code from the form's Load event (run once on open) or from the form's Current event (run for each record you navigate to).  You would use the Current event if you want to trigger the code for certain records but you would make it conditional.

Then, if you want to give the user the option of manually running the code also, use a button rather than a checkbox.  Buttons are the visual trigger to "do" something.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jeffrey CoachmanMIS LiasonCommented:
I agree with Helen, ...you can put code on the Click event, ...but you cannot "trigger" a click event in code...

Can we ask why this is needed, ...perhaps there is a better way...
0
hnasrCommented:
Try: Not sure if it is that simple, and I guess this why Jeffrey is inquiring about the purpose.

Private Sub Form_Load()
    txtBox_Click ' this runs the code in click event of txtBox control
End Sub
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.