Results 1 to 5 of 5

Thread: filter a subform from a combo box

  1. #1
    Join Date
    Aug 2010
    Posts
    3

    filter a subform from a combo box

    I'm new here so please consider me a novice at this. I have a combo box located on a switchboard with a subform on the same switchboard. I'm trying to filter the subform with a combo box. The combo box contains the numbers 01 to 20. The data it is filtering always contains the first two digits and that works well. My problem is that there are other numbers that may begin with the two digit code but has trailing characters, e.g., 18,1801,1810,180101 etc., and I want these items to show up when 18 is selected from the combo box.
    The field that's being filtered is titled WBS
    The combo box is combo216
    Code to filter the two digit numbers is:

    Private Sub Combo216_AfterUpdate()
    DoCmd.ShowAllRecords
    With Me.[CES_2009A_ENG SUBFORM].Form
    Me.Filter = "wbs = combo216"
    Me.FilterOn = True
    End With
    End Sub

    Would really appreciate your help; thanks in advance

  2. #2
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Try:

    Code:
    Me.Filter = "wbs Like " & Me.combo216 & "*"
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  3. #3
    Join Date
    Aug 2010
    Posts
    3
    HiTechCoach,
    Thanks so much for taking your time to respond. The solution didn't work for me so I'm still trying.
    Thanks, WTK

  4. #4
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Try:

    Code:
    Private Sub Combo216_AfterUpdate()
    DoCmd.ShowAllRecords
    
    ' Filter Sub Form
    With Me.[CES_2009A_ENG SUBFORM].Form
      .Filter =  = "wbs Like " & Me.combo216 & "*"
      .FilterOn = True
    End With
    
    End Sub
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  5. #5
    Join Date
    Aug 2010
    Posts
    3
    Hello again HiTechCoach,
    This doesn't work either but again thanks for info.
    ALike "18" & "%" works in the WBS field in a query but I cannot get it to work in code. If you could get this to work in code that would be awesome.
    Again, thanks for your help. wtk99

Posting Permissions

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