Recalc Combo Box - F9

  • Thread starter Thread starter Fev
  • Start date Start date
F

Fev

Hi
I would appreciate some help with the vba code for the following
problem.
I have an unbound combo box cboFamily on my main form frmNewHousehold
to select a family from my tblFamily. I have a subform frmNewMember
which is linked to my main form by the FamilyID field. I have an
unbound combo box cboName on the subform to select a particular member
of the family. The subform is based on a query qryFamilyMember. I
can select a new family with cboFamily, however I have to click in the
cboName and press F9 to get it to display the correct family members.
I can then choose from the combo box to move to the correct family
member information in the subform.

I have tried numerous lines of code using Requery, Recalc and Repaint
on the AfterUpdate of the cboFamily and cboName, as well as Change,
BeforeUpdate on cboName, but I cannot get the combo box to update
through code, but works beautifully when I press F9.

Any help would be apprreciated.
Thanks
Heather
 
Heather:

All it should need is to requery the combo box on the subform in cboFamily's
AfterUpdate event procedure. To reference a control on a subform you do so
by means of the Form property of the subform control in the parent form
(that's the control which houses the subform, and can have the same name as
its source form object, but not necessarily), e.g.

Me.YourSubformControl.Form.cboName.Requery

Ken Sheridan
Stafford, England
 
Heather:

All it should need is to requery the combo box on the subform in cboFamily's
AfterUpdate event procedure.  To reference a control on a subform you do so
by means of the Form property of the subform control in the parent form
(that's the control which houses the subform, and can have the same name as
its source form object, but not necessarily), e.g.

Me.YourSubformControl.Form.cboName.Requery

Ken Sheridan
Stafford, England







- Show quoted text -

Hi Ken
Thanks it worked like a dream, I was using the subform name as opposed
to the subform control's name.
Regards
Heather
 
Back
Top