listbox requery

J

JohnE

I have a form that uses a subform control for displaying many subforms. The
issue is regarding the requerying of a listbox on a subform that is displayed
in the sfrm control. On the main form there is a drop list that the project
can be selected from. Once selected the appropriate data appears. What I
need to have done is to requery a listbox on a subform when the project
changes. Otherwise, all else works.

I have tried different combinations but not finding the right one. Here is
how the layout goes;

frmProject - main form with drop list of projects

ProjectChildSubforms - name of subform control that is used to display the
different subforms

sfrmVersion - a subform that is displayed with the listbox needing to be
requeried

lstVersionListing - the list box needing to be requeried.

Hope someone can piece this all together so it works in the afterupdate
event of the main form's drop list?

Thanks for the help on this.
.... John
 
G

Graham Mandeno

Hi John

You need some code similar to this:

If Me.ProjectChildSubforms.SourceObject = "sfrmVersion" Then
Me.ProjectChildSubforms.Form!lstVersionListing.Requery
End If

If your main form is bound to your Projects table and the subform control's
LinkMasterFields is a bound control containing the ProjectID, then put this
code in the Form_Current event procedure.

If the subform control's LinkMasterFields is the unbound combo box from
which the project is selected, then put this code in the combo's
AfterUpdate event procedure.
 
J

JohnE

Mr Mandeno, this worked perfectly.
Thanks.
.... John


Graham Mandeno said:
Hi John

You need some code similar to this:

If Me.ProjectChildSubforms.SourceObject = "sfrmVersion" Then
Me.ProjectChildSubforms.Form!lstVersionListing.Requery
End If

If your main form is bound to your Projects table and the subform control's
LinkMasterFields is a bound control containing the ProjectID, then put this
code in the Form_Current event procedure.

If the subform control's LinkMasterFields is the unbound combo box from
which the project is selected, then put this code in the combo's
AfterUpdate event procedure.
--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

JohnE said:
I have a form that uses a subform control for displaying many subforms.
The
issue is regarding the requerying of a listbox on a subform that is
displayed
in the sfrm control. On the main form there is a drop list that the
project
can be selected from. Once selected the appropriate data appears. What I
need to have done is to requery a listbox on a subform when the project
changes. Otherwise, all else works.

I have tried different combinations but not finding the right one. Here
is
how the layout goes;

frmProject - main form with drop list of projects

ProjectChildSubforms - name of subform control that is used to display the
different subforms

sfrmVersion - a subform that is displayed with the listbox needing to be
requeried

lstVersionListing - the list box needing to be requeried.

Hope someone can piece this all together so it works in the afterupdate
event of the main form's drop list?

Thanks for the help on this.
... John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top