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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I us SETFOCUS to a text box upon return to form

Status
Not open for further replies.

djj55

Programmer
Feb 6, 2006
1,761
US
In Access XP SP3

The form has a button that opens another form. When the second form is closed I want the focus to be a particular text box. I assume it is done with me.txtbox.setfocus but where do I put the code?
form current
form gotfocus
form ???

Thanks

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
a button that opens another form
What is the VBA code doing that ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
There are two, the first one I can add the code to the button click code, the second one is where the problem occurs. If I add the code to the second click code will if fire at a bad time where me. is not defined or the wrong form?
Code:
    DoCmd.OpenForm stDocName, , , , , acDialog
    DoCmd.OpenForm stDocName

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
Why not using acDialog too in the second click code ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
try in the close event of the second form...

Forms!yourFormname!yourControlname.SetFocus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top