简体   繁体   English

在MS Access中,控件如何使用显示字段列表的组合框显示基于字段选择的值?

[英]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 : 我有一张这样的桌子:

表NbSpecies每年
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.

相关问题 如何使用组合框显示一个表中的数据,然后使用MS Access将其添加到另一个表中? - How can I use a combo box that displays data from one table and add it to another using MS Access? 如何根据MS Access 2007中的组合框中的值填充文本框的值? - How to populate the value of a Text Box based on the value in a Combo Box in MS Access 2007? MS ACCESS:如何使用组合框和查询条件过滤报告 - MS ACCESS: How to filter report using combo box and query criteria MS Access组合框 - MS Access combo box 根据选择框定义隐藏字段值 - Defining hidden field value based on select box selection 访问子窗体SUM()在主访问窗体上的计算字段中显示#Error - Access Subform SUM() Displays #Error for calculated field on main Access Form MS Access:如何使用下拉组合框控件在表单中填充多个文本字段 - MS Access: How to use a pulldown combo-box control to populate multiple text fields in a form MS Access数据表不会基于组合框更新 - MS Access datasheet won't update based on combo box 如何基于下拉框选择自动生成文本字段 - How to auto generate a text field based on a drop down box selection ms Access根据另一种形式的其他组合框填充一种形式的组合框 - ms access populate combo box in a form based on other combo box in another form
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM