Avatar of dkim18
dkim18
 asked on

Referencing the combo box in the subform?

I am trying to requery for the combo box in another form.

I have two forms.
frmPublication/frmqryAffiliatiion_subform
frmAuthor

When I adda new record in the frmAuthor, I want to requery the combo box in the subform of the frmPublication.

I don't see the control name for the combo box in the subform.
It is tied to the AuthorID so I am using the AuthorID as the controlID.

The subform has several textboxes to display the fields. I converted the textbox to a combo box.


How can I reference the combo box of subform in another form?

There is no field named "Forms!frmPublication.[frmqryAffiliation subform].Form.AuthorID in the current record.
Microsoft AccessVisual Basic ClassicVisual Basic.NET

Avatar of undefined
Last Comment
mbizup

8/22/2022 - Mon
SOLUTION
mbizup

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
mbizup

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dkim18

ASKER
I have it as AuthorID.
mbizup

Can you upload a sample copy of your database, with any sensitive data removed?
dkim18

ASKER
I check the subform name too, frmqryAffiliation Subform.
It is same.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
als315

Create empty query, use builder to select your field (start from main form, then select subform), copy full name of field from query builder to VBA code
dkim18

ASKER
OK. I got it fixed.

I used the macro to requery.
It was giving me that errror.

I changed it to the event code and it is working fine.

Why would macro error out though?
mbizup

I ran into siomething similar in another question recently.

In that case it turned out to be a timing issue -- the Macro was getting executed before the subform was actually loaded.

With VBA, the timing of form/subform events is a lot more clear-cut.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.