我正在尝试从组合框中过滤记录,如果我选择开普敦,只有开普敦记录必须显示在子表单中,但如果我选择德班,只有德班记录必须显示在子表单中。我没有收到任何错误,但是如果我选择开普敦只有开普敦记录显示,并且一旦我选择德班,开普敦记录仍然显示它不会更改以在子表单中显示德班记录。下面是我的代码,任何帮助将不胜感激谢谢
If Me.Combo0.Value Then
strFilters = "Sites = 'Cape Town'"
DoCmd.OpenForm "Home"
Forms!Home![Plant Transaction subform].Form.Filter = strFilters
Forms!Home![Plant Transaction subform].Form.FilterOn = True
ElseIf Me.Combo0.Value Then
strFilters = "Sites = 'Durban'"
DoCmd.OpenForm "Home"
Forms!Home![Plant Transaction subform].Form.Filter = strFilters
Forms!Home![Plant Transaction subform].Form.FilterOn = True
End If