Filter a subforms combo box

Rusty

Registered User.
Local time
Today, 15:40
Joined
Apr 15, 2004
Messages
207
:confused: Help me!!

I have a main form, " frmFundingDistribution ", with a combo box "cboProjectRef";
and a sub form "subfrmEventPayments " that has a combo box " cboEventDescID".

I need the combo box on the subform to filter based upon combo box on the main form.

Now I've tried putting this in as the row source for the subform's combobox:

SELECT [tblEventDescription].[Event Name], [tblEventDescription].[Event Number], [tblEventDescription].[Event Desc ID], [tblEventDescription].[ProjectReference] FROM tblEventDescription WHERE ((([tblEventDescription].[ProjectReference])=[Forms]![frmFundingDistribution]![cboProjectRef]));

Now this should work fine and it may appear to work for the first record. However, Access is stupid :mad: and will not automatically check to see if the "cboProjectRef" field on the main form has changed or if I have moved to a new record.

How do I sort this? Is it with a requery?

Rusty
:D
 
Cracked it!!!

On the main form enter:

Private Sub Form_Current()
Me.[subfrmEventPayments]![cboEventDescID].Requery
End Sub

and just to be on the safe side…

On the subform enter:

Private Sub Form_GotFocus()
Me.cboEventDescID.Requery
End Sub

Hope that helps other who may see this,

Rusty
:D
 

Users who are viewing this thread

Back
Top Bottom