Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm just looking for an easy way to filter a subform (subform based on query) using a toggle. Something that is also easy to expand on since I can foresee multiple toggle buttons. Thanks.

  2. #2
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On your toggle button -- or, perhaps, from a dropdown combo selector -- check the value of the toggle or the dropdown, and change the record source of your subform:

    Forms![YourParentForm]![YourSubformName].Form.RecordSource = "Select * from YourOriginalQuery where ToggleField = " & YourJust-SelectedToggleValue
    .... and then re-query the subform's recordsource: Forms![YourParentForm]![YourSubformName].Form.Requery

    If this isn't what you're looking for, why don't you post a bit of your code.

    Pat

  3. #3
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    You can filter a form (or subform) either by changing its recordsource as Pat has suggested, or just by setting its "Filter" property to a string value, then setting the filterOn property to true.

    Code:
    Dim frm as form
    Set frm as me.subformcontrol.form
    frm.filter= "Surname like " & chr(34) & "A*" & chr(34)
    frm.filteron =true
    Chr(34) is just code for double quotes. Text values must be surrounded by double quotes.
    Regards
    John



Posting Permissions

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