MS Access 2010 使用来自另一个元素的 parameterf 为表单设置行源

MS Access 2010 Set up Row source for form with parameterf from another element

我的数据库在 Access 2010 中包含下表:

TblServices [ServiceCountry,ServiceName]

TblServiceCountry [CountryID,CountryName]

TblServiceList[ListID,ListName,ListCountry]

我已经尝试在由 tblServices 制作的表单中进行多次查询,以获取 Servicename 的行 Source 以仅采用具有该记录的 ListCountry Null 或 ListCountry=ServiceCountry 的 ListName,但没有成功。

SQL Query:Select DISTINCT ListID, ListName From ServiceList, Services Where (IsNull(ListCountry)<>False AND (IsNull(ListCountry)<>False OR ListCountry=ServiceCountry);

例如: 服务列表:

ListID | ListName         | ListCountry
1      |   Tax Service    | NULL 
2      |   Clean Service  | Italy
3      |   Food Service   | USA

我是 Access 新手,如有任何帮助,我们将不胜感激!谢谢!

应该只需要OR运算,只需要TblServiceList。建议为不同于字段的 ServiceCountry 命名组合框,例如 cbxCountry。

TblServiceList保存的是服务和国家的实际描述文字,不是ID?字段中真的没有 NULL 一词吗?如果要保存ListName 的描述性文字,则不需要ListID。如果要保存 ListID 那么 DISTINCT 就没有意义了。

尝试:

Select DISTINCT ListName From TblServiceList Where ListCountry Is Null OR ListCountry LIKE [cbxCountry] & "*";