Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jumping to Text Box

Status
Not open for further replies.

lizray

Programmer
May 14, 2008
126
AU
I have a button, executing code on Click event. On certain conditions it needs to get a filename. I have a text box which I make visible for the filename. The question is How do I jump to the textbox, get the filename, and resume the original code. I have tried a textbox.setfocus and on textbox exit event, goto a label within the original code, but this does not work ???
 
.setfocus is the correct way so you are doing something incorrectly. Provide your code so far.
 
How are ya lizray . . .

Have a look at the [blue]InputBox[/blue] function!

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks aceman1, I dont know why the setfocus didnt work, butthe Inputbox function solved the problem
 
lizray said:
[blue] . . . I dont know why the setfocus didnt work . . .[/blue]
The easiest way to interrupt VBA code until some task is accomplished, is thru [blue]Modal Forms or Function[/blue] windows. Modal to you meaning you can't select anything else until the modal window is closed.

MsgBox and InputBox are modal functions! Say you have the following:
Code:
[blue]   Me!TextboxName = InputBox("Enter Name?")[/blue]
When that line of code hits InputBox, the code opens the box and stops running. No assignment to Me!TextboxName is made until you exit that window.

Your code failed because it didn't wait for input after setfocus! The code just kept running right on!

BTW: Welcome to [blue]Tek-Tips![/blue] [thumbsup2] Do have a look at one of the links at the bottom of my post. The links will help you [blue]ask better questions[/blue], get [blue]quick responses[/blue], [blue]better answers[/blue], and insite into [blue]etiquette[/blue] here in the forums. Again . . . Welcome to [blue]Tek-Tips![/blue] [thumbsup2] [blue]Its Worthy Reading![/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top