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

reference a main form from a subform 1

Status
Not open for further replies.

vinanti

Programmer
Mar 7, 2003
26
IN
hi,
i am facing a problem:
i have a form with a subform control on it..now when the user enters a record the control shifts properly from the main form to the subform,but after completion of filling details in the subform i want the focus to go on the add button on my main form,when i give :
forms!mast!add_cmd.setfocus it produces an error and says that the control is either a label or ....
i tried passing the focus to various other controls on the main form but all in vain.

please help!!!
thanks in advance.
 
When addressing subforms you need to remember that the subform is a control, and has a form object in it.
Thus the correct notation from your form is:

Subform.Form!controlname

From the subformm, you can use the Parent! identifier to access the holding form as a quick way.

So in your example, try

Parent!add_cmd.SetFocus

John
 
hi,
thanks a lot john,
this really worked out.

bye
vinanti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top