vba ms-access:控制源和行源的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2812971/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:38:11  来源:igfitidea点击:

ms-access: difference between control source and row source

sqlms-accessvba

提问by l--''''''---------''''''''''''

i have learning reports in access and i don't understand the difference between these two concepts. i understand that the control source is the column? but then what is the row source?

我在访问中有学习报告,但我不明白这两个概念之间的区别。我知道控制源是列?但是行源是什么?

回答by Thomas

Row Sourceis typically used to determine how to build a list of items whereas Control Sourcedetermines what field will be used to store or retrieve the value. For example, in a Combo Boxyou have both properties. The Row Sourcedetermines how to build the list the user sees when they hit the down arrow. The Control Sourcedetermines where to store the value that the user selects.

Row Source通常用于确定如何构建项目列表,而Control Source确定将使用哪个字段来存储或检索值。例如,在 a 中,Combo Box您同时拥有这两个属性。在Row Source决定如何建立用户看到,当他们打的向下箭头列表。在Control Source确定在哪里存储的值,用户选择。

EXAMPLESuppose we have a form that is bound to table called Carswhich lists information about automobiles. One of the columns in this table is used to store the color of the car. Let's suppose that column is named BodyColor. You also have another table of allowed colors (e.g. Blue, Yellow, Green, Steel Blue, Midnight Blue etc.). You want to ensure that users choose from this list of colors when they enter a value for the car's color.

示例假设我们有一个表单绑定到一个名为的表Cars,该表列出了有关汽车的信息。此表中的一列用于存储汽车的颜色。假设该列名为BodyColor。您还有另一个允许的颜色表(例如蓝色、黄色、绿色、钢蓝色、午夜蓝色等)。您希望确保用户在输入汽车颜色值时从该颜色列表中进行选择。

On our form we add a Combo Box where we set the following properties:

在我们的表单上,我们添加了一个组合框,我们在其中设置了以下属性:

Control Source  :   BodyColor
Row Source      :   SELECT Colors.Name FROM Colors ORDER BY Colors.Name;
Row Source Type   :   Table/Query

When a user sees your Combo Box, they will be able to hit the down arrow on the Combo Box and see a list of colors. When they choose a color, the Form will save their selection into the BodyColorcolumn.

当用户看到您的组合框时,他们将能够点击组合框上的向下箭头并看到颜色列表。当他们选择一种颜色时,表单会将他们的选择保存到BodyColor列中。