简体   繁体   English

MS-Access组合框控制源

[英]MS-Access combo box control source

Is it possible to use an IIf statement in the control source of a combo box? 是否可以在组合框的控制源中使用IIf语句? I have a combo box that I want to pull a series of names from the associated table if their position is like "Ops". 我有一个组合框,如果它们的位置像“ Ops”,我想从关联的表中提取一系列名称。 Here is what I have tried in the control source for the combo box. 这是我在组合框的控制源中尝试过的内容。

=IIf(Roster!Position Like "Ops*",Roster!Last,"")

I am fairly sure it is possible, what am I doing wrong? 我相当确定这是可能的,我在做什么错?

Mods based on feedback from HansUp Mods基于HansUp的反馈

SQL for query SQL查询

SELECT Roster.Last
FROM Roster
WHERE (((Roster.Position) Like "Ops*"))
GROUP BY Roster.Last;

Combo Box: Supervisor 组合框:主管

Control Source
=Supervisor!Last

Still returns no data. 仍然不返回任何数据。

I have a combo box that I want to pull a series of names from the associated table if their position is like "Ops". 我有一个组合框,如果它们的位置像“ Ops”,我想从关联的表中提取一系列名称。

Use a query as the combo's Row Source. 使用查询作为组合的行源。

SELECT [Last], [another field ?]
FROM Roster
WHERE Position Like "Ops*";

Then the combo's Control Source can be a query field. 然后组合的控制源可以是一个查询字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM