Subform filtering based off multiple parameters (Combobox AND Textbox)

前端 未结 1 1709
無奈伤痛
無奈伤痛 2021-01-27 17:24

I want to filter a subform based on two parameters on a form (combobox and textbox).

I have a Form with combobox cboTimePeriod which show data from table TimePeriod (exa

相关标签:
1条回答
  • 2021-01-27 17:58

    I guess TimePeriod is numeric, thus (and correction the spaces):

    strWhere = strWhere & "[TimePeriodID] = " & Me!cboTimePeriod.Value & " AND "
    

    and:

    strWhere = strWhere & "[CityName] = '" & Trim(Me!txtSelectedCity.Value) & "' AND "
    

    Edit: To look up another column, here the second column:

    strWhere = strWhere & "[CityName] = '" & Trim(Me!txtSelectedCity.Column(1)) & "' AND "
    
    0 讨论(0)
提交回复
热议问题