如何根据Access数据库中的多值Lookup字段选择行?
使用多数据列时,以下ASP代码不返回任何值:
<%
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
%>
答案 0 :(得分:0)
如果UserStatus
是一个多值Lookup字段,那么该字段的各个值将通过UserStatus.Value
访问,因此您需要使用
... WHERE UserStatus.Value = 'Active' ...