Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18

    Question Unanswered: filtering a subform

    Hi,

    I have a form with a subform. and I want a Combobox on the form to filter the results on the subform.

    The fom is called frmSets, the subform is subformBom the combo box is cmbSelectSet and I'm trying to filter it on the field parent_sku in a table called Bom, which the subform is based upon and the combobox is constructed from.

    I currently have:
    Private Sub cmbSelectSet_Change()
    Me.subformBom.Form.Filter = "[bom].[parent_sku] = [forms]![frmSets]![cmbSelectSet]"
    Me.subformBom.Form.FilterOn = True
    Me.Refresh
    End Sub

    Which I'm sure was working earlier today, but seems to have stopped working now with the error message of,

    "Method 'Form' of object '_SubForm' failed"

    Any help muchly appreciated!

    Dion

  2. #2
    Join Date
    Nov 2002
    Posts
    150

    Re: filtering a subform

    Try: Me.subformBom.Form.Filter = "[bom].[parent_sku] = " & Me.cmbSelectSet

  3. #3
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18

    Red face Re: filtering a subform

    No. I'm afraid it still gives the same error.


    Originally posted by FirstAndGoal4
    Try: Me.subformBom.Form.Filter = "[bom].[parent_sku] = " & Me.cmbSelectSet

  4. #4
    Join Date
    Nov 2002
    Posts
    150

    Re: filtering a subform

    how about: Me.Form.subformBom.Form.Filter = "[bom].[parent_sku] = " & Me.cmbSelectSet

  5. #5
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18
    Still the same error

  6. #6
    Join Date
    Jan 2003
    Posts
    46
    How about trying a different approach. There is never just one way of doing something in Access.

    Open the SQL statement/query used as the subform's recordsource. Set the key field's criteria to the combo box (Forms!YourFormName!YourComboBoxName).

    Then requery the subform on the combobox's AfterUpdate event.

    Also make sure you are not confusing the name of the child form with the name of the subform. They may not be the same.

    Cheers, Bill

  7. #7
    Join Date
    Feb 2003
    Location
    Staffs, England
    Posts
    18

    Talking

    cheers for the help you guys, got it fixed.

    Dion

Posting Permissions

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