Avatar of rsb1222
rsb1222 asked on

Code for Requery for a Combo Box Located in a Sub Subform in a Tab Control

Novice here.  I need code for an After Update event for a Combo Box on a main form.

I want to requery a combo box that is located in a subform of a subform which is located in a tab of a tab control.

Form:  frmOpportunities
Tab Control:  TabCtlOpps
Tab: General
Subform: sbfrmOppProjGeneral
Sub Subform: sbfrmOppProjContact
Control:  cboContactPerson

Here is what I've tried:

Forms!frmOpportunities.TabCtlOpps.General.sbfrmOppProjGeneralInfo.sbfrmOppProjContacts.Form!Controls.cboContactPerson.Requery

(all on one line)

Thanks!
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
Dale Fye

the tab control is immaterial to this discussion.

If the combo is on the main form, then you should be able to use something like:

me.sbfrmOppProjGeneral.form.sbfrmOppProjContact.form.cboContactPerson.requery

But your subform description above says the subform name is sbfrmOppProjGeneral, but your line of code says "sbfrmOppProjGeneralInfo"

the general syntax for doing this is:

me.subformControlName.Form.controlname.requery

Make sure the what you are using as the subform control name is if fact the name of the control, not the form (although they may be the same).  In your case, the 2nd subform is simply the control on the 1st subform, so it would be:

me.1stSubformControlName.Form.2ndSubformControlName.Form.Controlname.requery
ASKER CERTIFIED SOLUTION
Dale Fye

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck