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

if-then statement to jump to subform on exit

Status
Not open for further replies.

ehdoh

Technical User
Joined
Aug 4, 2003
Messages
8
Location
US
Hello,

I have a main form with several subforms embedded in it. At points in the mainform and several points in the subforms, the answers provided in combo boxes will determine where the user should be directed for the next portion of data entry. Thus far I have used macros to govern this. When an entry on the mainform requires a jump to a subform, I tried governing this via an openform command on a macro but the problem is that the subform then opens as its own form. What I want to occur instead is for the user to be directed to the first control in the subform (where it is embedded in the mainform) rather than have the subform open anew. Is there a way to do this via code? I imagine I would be able to control this movement more readily in code than in a macro, hence me posting this question on this particular forum. If there is a way to do this via macro and any of you know how, I would also be interested in learning this.

Thank you!
EH
 
I received a notification stating that mikeyb540 responded to this thread, but I do not see any such response here. mikeyb540, if you did indeed intend to respond could you possibly re-send???

Thank you!
 
Hi,

In code you can just set the focus to the subform control:

Forms("MainForm")("Subform").SetFocus

or from the form module itself:

ctlSubform.SetFocus


This should set the focus to the 1st control on that subform.

Dean :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top