仅以连续形式更改控件源选定的组合框 [英] Change control source only selected combo box in continous form

查看:31
本文介绍了仅以连续形式更改控件源选定的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如您所见,用户可以选择合同或提案

As you can see here, the user can chose a contract or a proposal

如果是提案或合同,参考控制源是不一样的.

The reference control source is not the same if it's a proposal or a contract.

所以在类型组合框类型的更新后,我这样做

So in the after update of the type combo box type, I do this

Private Sub cbType_AfterUpdate()
    If ([ReferenceType] = "Proposal") Then
        cbReference.ControlSource = "[ProposalNo]"
        cbReference.RowSource = "SELECT ProposalNo FROM Proposals WHERE ProposalNo is not null"
    ElseIf ([ReferenceType] = "Contract") Then
        cbReference.ControlSource = "[ContractNo]"
        cbReference.RowSource = "SELECT ContractNo FROM Proposals WHERE ContractNo is not null"
    End If
End Sub

问题是它改变了所有行的控制源.

The problem is it change the control source for all rows.

有没有办法只为选定的行更改它?

Is there a way to change it only for the selected row?

谢谢

推荐答案

不,没有.您可以将连续表单视为显示其他行的单个表单.对未绑定控件的任何操作都会影响所有行.有一些可能适合的变通方法.例如,您可以显示参考文本框和更改参考"组合.这将避免混淆用户,因为绑定的文本框不会更新.您可以使用条件格式设置更改组合的各种属性,使其更漂亮.或者,您可以使用两个子表单或一个弹出表单来编辑数据.

No, there is not. You can think of a continuous form as a single form that shows you other rows. Any action on an unbound control affects all the rows. There are work-arounds that may suit. For example, you can show a textbox for the Reference and a "Change reference" combo. This will avoid confusing users because the bound textbox will not update. You can set various properties of the change combo with conditional formatting to make it all prettier. Alternatively, you can use two subforms or a pop-up form to edit data.

这篇关于仅以连续形式更改控件源选定的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆