using a multi-value Lookup field in a WHERE clause

2019-07-27 06:45发布

How do you select rows based on a multi-value Lookup field in an Access database?

The below ASP code returns no value when using multi-data column:

<%
Dim Contractors
Dim Contractors_cmd
Dim Contractors_numRows

Set Contractors_cmd = Server.CreateObject ("ADODB.Command")
Contractors_cmd.ActiveConnection = MM_Listings_STRING
Contractors_cmd.CommandText = "SELECT * FROM Contractor WHERE UserStatus = 'Active' AND     AgentID= "& Session("AgentID") 
Contractors_cmd.Prepared = true

Set Contractors = Contractors_cmd.Execute
Contractors_numRows = 0
%>

1条回答
祖国的老花朵
2楼-- · 2019-07-27 07:21

If UserStatus is a multi-value Lookup field then the individual value(s) of that field are accessed via UserStatus.Value so you'll need to use

... WHERE UserStatus.Value = 'Active' ...
查看更多
登录 后发表回答