Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Question Unanswered: Filter a combo box on a subform

    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 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

  2. #2
    Join Date
    Feb 2004
    Location
    UK
    Posts
    246
    Hi Rusty,
    I know this won't be much help but I have seen how this is done on this forum, unfortunately I can't remember the answer and the search function isn't working.
    Hopefully someone will come along with the answer or the search will work

    Regards
    John

  3. #3
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Talking Cracked it!!!

    Thanks for your help chap, I've 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •