[英]In MS Access, how a control can displays a value based on a field selection using a combo box that displays a Field list?
I have a table like this one : 我有一张这样的桌子:
This table represents a species (No = 3) and the number of individual for the last 6 years. 该表代表一个物种(No = 3)和最近6年的个体数量。 (FYI, the table cannot be displayed differently.) (仅供参考,不能以其他方式显示表格。)
I created a Combo Box which displays the last 6 years (based on a field list). 我创建了一个组合框,用于显示最近6年(基于字段列表)。
What I have to do so that the turquoise rectangular automatically displays "31", for example, if the year "2014" is selected? 我必须怎么做才能使绿松石矩形自动显示“ 31”,例如,如果选择年份“ 2014”?
The question doesn't contain enough detail about the host form and other bound controls, so the following is just a pattern to follow. 该问题没有包含有关宿主窗体和其他绑定控件的足够详细信息,因此以下仅是一种模式。
Set the Control Source of the turquoise (ie cyan) control to something like 将绿松石(即青色)控件的“控件来源”设置为类似
= DLookup("[" & comboboxYear.Value & "]", "TableName", "ELEMENT_ID=" & [ELEMENT_ID])
This assumes that there is a bound control named [ELEMENT_ID] on the form. 假定表单上有一个名为[ELEMENT_ID]的绑定控件。 Brackets wrap the ComboBox value to ensure the value is interpreted as a column name and not a number. 方括号包装ComboBox值以确保将该值解释为列名而不是数字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.