组合框级联效应不工作的不同行 [英] combobox cascade effect not working for different rows

查看:264
本文介绍了组合框级联效应不工作的不同行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个subform.The第一组合框2组合框是用来填充第二个组合框。这些都是摆在窗体的详细信息部分。我想他们的工作是这样的:当我选择从第一个组合框中的任何值,我想在同一行的第二个组合框得到填充的相关值

截至目前,我试图实现这一点,因为我从第1行的第一个组合框中选择任何价值我看同一行的第二个组合框被填充,但是当我去的第一套组合框的选择值我看到在第二盘上面的改变或变得无效的组合框的的值。

这里的code:

第1组合框是cboRCMTask:

 私人小组cboRCMTask_AfterUpdate()
    Me.cboRCMTaskOptions.RowSource =SELECT ID,RCMTaskOptions从tblRCMTaskOptions WHERE RCM_ID =&放大器; Me.cboRCMTask.Column(0)及;
    Me.cboRCMTaskOptions = Me.cboRCMTaskOptions.ItemData(0)
    Me.cboRCMTaskOptions.Requery
结束小组
 

cboRCMTaskOptions是第二个组合框。

在form_current事件:

 私人小组Form_Current()
    Me.cboRCMTask.RowSource =SELECT ID,RCMTask从tblRCMTask;
    如果ISNULL(txtRCM_ID)然后
        Me.cboRCMTask = Me.cboRCMTask.ItemData(0)
    结束如果
    Me.cboRCMTaskOptions.RowSource =SELECT ID,RCMTaskOptions从tblRCMTaskOptions WHERE RCM_ID =&放大器; Me.cboRCMTask.Column(0)及;
    如果ISNULL(txtRCMOption_ID)然后
        Me.cboRCMTaskOptions = Me.cboRCMTaskOptions.ItemData(0)
    结束如果
结束小组
 

解决方案

从您的描述,您使用的是连续形式。虽然它看起来像一个连续的形式有很多行,从编码的点,你可以认为它刚一行,当前行。我怀疑,控制源组合2是在组合隐藏,数字列,当您更改行来源的组合,可见行不能再被发现,所以它无法显示。你或者可以提供用于编辑的弹出窗口的形式,或文本框来存储形式和稍微狡猾的组合,以编辑该值的价值。你可以做一些改善使用条件格式的外观。

I have two comboboxes on a subform.The first combobox is used to populate the second combobox. These are placed in the detail section of the form. I want them to work this way:when I select any value from the first combobox, I want the second combobox of the same row to get populated by relevant value.

As of now, I have tried to implement this and as I select any value from the first combobox of row 1 I see the second combobox of the same row gets populated but as I go on selecting values from the first set of comboboxes I see that the values in the second set of the comboboxes above changing or becoming null.

Here's the code:

The 1st combobox is cboRCMTask:

Private Sub cboRCMTask_AfterUpdate() 
    Me.cboRCMTaskOptions.RowSource = "SELECT ID, RCMTaskOptions FROM tblRCMTaskOptions WHERE RCM_ID=" & Me.cboRCMTask.Column(0) & ";" 
    Me.cboRCMTaskOptions = Me.cboRCMTaskOptions.ItemData(0) 
    Me.cboRCMTaskOptions.Requery 
End Sub 

cboRCMTaskOptions is the second combobox.

The form_current event:

Private Sub Form_Current() 
    Me.cboRCMTask.RowSource = "SELECT ID, RCMTask FROM tblRCMTask;" 
    If IsNull(txtRCM_ID) Then 
        Me.cboRCMTask = Me.cboRCMTask.ItemData(0) 
    End If 
    Me.cboRCMTaskOptions.RowSource = "SELECT ID, RCMTaskOptions FROM tblRCMTaskOptions WHERE RCM_ID=" &    Me.cboRCMTask.Column(0) & ";" 
    If IsNull(txtRCMOption_ID) Then 
        Me.cboRCMTaskOptions = Me.cboRCMTaskOptions.ItemData(0) 
    End If 
End Sub 

解决方案

From your description, you are using a continuous form. While it looks like a continuous form has many rows, from the point of view of coding you can consider it to have just one row, the current row. I suspect that the control source for combo 2 is a hidden, numeric column in the combo, when you change the row source for the combo, the visible row can no longer be found, so it cannot be displayed. You will either have to provide a pop-up form for editing, or a textbox to store the value for the form and a slightly dodgy combo to edit that value. You can do a little to improve the appearance with conditional formatting.

这篇关于组合框级联效应不工作的不同行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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