【问题标题】:Microsoft Access Combo boxes and vba code 2007Microsoft Access 组合框和 vba 代码 2007
【发布时间】:2014-07-31 17:43:21
【问题描述】:

我有两个组合框,每个组合框都有不同的下拉项

组合框 1:新的、已售出的、已淘汰的 组合框 2:未分配、已停用、已返工、已发货

我想要这样当用户从组合框一中选择新建或退休时,相应的值会显示在组合框二中。

我为组合框 1 使用了 on click sub

If Me.combox1.Value = "New" Then
Me.combox2.Value = "Unallocated"
End If

If Me.combox1.Value ="Retired" Then
Me.combox2.Value = "Retired"
End If

我不需要为这两个框的所有值同步这两个框。

我只是在学习 VBA 代码以进行访问,所以我不确定实现这一点的最佳方法。

【问题讨论】:

  • 我不熟悉 Access 表单,但您的代码看起来很合理。它有什么问题?

标签: vba combobox


【解决方案1】:
If Me.combox1.Value = "New" Then
Me.combox2.Value = "Unallocated"
ElseIf Me.combox1.Value ="Retired" Then
Me.combox2.Value = "Retired"
Else
'do nothing
End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-24
    • 1970-01-01
    • 1970-01-01
    • 2021-10-15
    • 2017-06-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多