如何根据main上的组合值在子窗体上创建组合框值 [英] How can I make a combo box value on a subform based on the combo value on a main for

查看:75
本文介绍了如何根据main上的组合值在子窗体上创建组合框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在主窗体上有一个带有子窗体的主窗体。主窗体有几个文本框和一个组合框。子窗体有几个文本框和一个组合框。我希望子窗体上的组合框中的值基于主窗体上组合框中的值。


例如,主要的组合框(cboCartStatus)表单将具有值:INSERVICE,AVAILABLE,UNKNOWN,DISPOSED和

子窗体上的组合框(cboCartEvent)将具有以下值:DELIVERY,DISPOSAL,FOUND,MISSING,REMOVAL,REPAIR,STOLEN,未知。


如果cboCartStatus是INSERVICE,则需要在子表单上的cboCartEvent中显示的唯一值是DELIVERY,REPAIR


如果cboCartStatus是AVAILABLE,则需要在子窗体上的cboCartEvent中显示的唯一值是REMOVAL

解决方案

< blockquote>这可以通过多种方式完成,但选择哪种方式取决于您未在问题中包含的信息。


例如:

  1. 你好吗?在主窗体上使用ComboBox?
  2. 如何在子窗体上填充ComboBox?
  3. 这些ComboBox的值何时以及如何更改(在什么情况下)?


在主窗体和子窗体上,正在从表中填充组合框。

一个名为tbl_CartInfoCodes的表。它使用的字段是:Code_Desc和Code_Type。


这是我正在使用的主表单上的组合框的查询:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


您好

您的第一个组合中的查询对我没有意义。我不相信你需要WHERE子句

展开 | 选择 | Wrap | 行号


I have a main form with a subform on the main form. The main form have a couple of text boxes and a combo box. The subform have a couple of text boxes and a combo box. I want the values in the combo box on the subform to be based on the values in the combo box on the main form.

For instance, the combo box (cboCartStatus) on the main form will have the values: INSERVICE, AVAILABLE, UNKNOWN, DISPOSED and
the combo box (cboCartEvent) on the subform will have the values: DELIVERY, DISPOSAL, FOUND, MISSING, REMOVAL, REPAIR, STOLEN, UNKNOWN.

if the cboCartStatus is "INSERVICE", the only values that need to show in the cboCartEvent on the subform is "DELIVERY", "REPAIR"

if the cboCartStatus is "AVAILABLE", the only value that need to show in the cboCartEvent on the subform is "REMOVAL"

解决方案

That can be done a number of ways, but which way to choose depends on information you haven''t included in your question.

Such as :

  1. How are you populating the ComboBox on the main form?
  2. How are you populating the ComboBox on the sub-form?
  3. When and how are the values of these ComboBoxes changed (under what circumstances)?


On both the Main Form and the Sub Form the combo box is being populated from a table.
A table called tbl_CartInfoCodes. it is using the fields: Code_Desc and Code_Type.

Here is the Query that I am using right now for the combo box on the Main form :

Expand|Select|Wrap|Line Numbers


Hi
The query in your first combo does not make sense to me. I don''t believe that you need the WHERE clause

Expand|Select|Wrap|Line Numbers


这篇关于如何根据main上的组合值在子窗体上创建组合框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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