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

closing a subform

Status
Not open for further replies.

ehreider

Technical User
Jan 19, 2005
3
US
I have searched through the existing threads for a solution to my problem, but can not find an answer that works.

Here is my issue. I have a form with two subforms - the second subform is embedded in the first subform. I want to close the second subform from a command button.

Payment - main form
depsplit - subform
paymentsplit - 2nd subform embedded in the depsplit form

Here is my code:


Forms!PAYMENT![Combo11].SetFocus
DoCmd.Close acForm, "payment!depsplit!paymentsplit"
Forms!PAYMENT!depsplit!paymentsplit.Visible = False

the form does not close and I do get an error message
"you can't hide a control that has the focus"

I thought I was changing the focus to the combo11 control on the main form PAYMENT.

Please help. Thank you.



 
Only a main form may be closed.
you may try something like this:
Forms!PAYMENT.SetFocus
Forms!PAYMENT![Combo11].SetFocus
Forms!PAYMENT!depsplit.Form!paymentsplit.Visible = False

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top