2017-03-15 49 views
0

我正在使用多值字段为人员分配不同的条件。这些标准分为不同的类别。我正在使用下拉列表来选择类别,选择一个会触发某个VBA,该VBA会更改显示条件的组合框。问题在于多值字段中的其他类别的标准在组合框中显示为ID号,因为控件源在多值字段中是固定的。我如何隐藏这些不需要的ID,或者这对我的方法是不可能的?在具有多值控件源的组合框中隐藏值

Table AdmitCriteria: 
    ID | fkCatID | Label 
    1 |  1  | xxx 
    2 |  1  | xxx 
    3 |  1  | xxx 
    4 |  2  | xxx 
    5 |  3  | xxx 
    6 |  3  | xxx 

Table Patients: 
    AdmitCrit (multi-value field) 

Form: 
    critCategoriesDropdown: rowsource = ID, Label FROM AdmitCriteria 
    cboCriteria: controlsource = AdmitCrit 
       rowsource: VBA 

-

Private Sub critCategoriesDropdown_AfterUpdate() 
    Dim strSource As String 
    Dim ctrlSource As String 

    strSource = "SELECT Id, Label FROM AdmitCriteria WHERE fkCatID = " & Me.critCategoriesDropdown.Column(0) & ";" 
    Me.cboCriteria.RowSource = strSource 
End Sub 

Unwanted ID's at the end

回答

0

把玩的设置,发现选项ShowOnlyRowSourceValues。这解决了这个问题。