Microsoft Access中的可编辑组合框

时间:2012-08-08 22:12:19

标签: vba vbscript ms-access-2007 ms-office office-2010

我尝试将可编辑组合框附近的内容添加到我的Access表单中,用户可以在其中输入所需内容或从可用条目列表中进行选择。我是新手,我很欣赏有关如何做到这一点的任何信息。

测试下面的代码时没有任何反应。

代码

Private Sub ddlUNS1_NotInList(NewData As String, Response As Integer)
    Dim ctl As Control

    ' Return Control object that points to combo box.
    Set ctl = Me!ddlUNSC1

    If MsgBox("Value is not in list. Add it?", vbOKCancel) = vbOK Then

        MsgBox ("ddlUNSLEVEL NOT LISTED FIRED ")
    Else 
        'ctl.Undo
        MsgBox ("ddlUNSLEVEL  LISTED FIRED ")
    End If
End Sub

1 个答案:

答案 0 :(得分:0)

有各种选择。您可以参考绑定字段:

Row Source: SELECT DISTINCT AddressType FROM ThisTable
Control Source : AddressType

这种用途有限,可能仅对短期数据库有用。

您可以使用NotInList and LimitToList添加新值。