我正在尝试在MS Access数据库中编写SQL代码,从而使Entity_name上的筛选器无法正常工作
Function FilterResults()
Dim strCriteria As String
strCriteria = ""
If Nz(Me.cboEntitynameFilter) <> "" Then
strEntityNameFilter = "Entity_Name = '" & Me.cboEntitynameFilter & "'"
Else
strEntityNameFilter = "Entity_Name = '*'"
End If
If Nz(Me.cboAssignmentFilter) <> "" Then
strAssignmentFilter = " AND " & "Assignment = '" & Me.cboAssignmentFilter & "'" '& " AND "
End If
If Nz(Me.cboFYFilter) <> "" Then
strFYFilter = " AND " & "Financial_Year = '" & Me.cboFYFilter & "'"
End If
strCriteria = Nz(strEntityNameFilter, "*") & Nz(strAssignmentFilter, "*") & Nz(strFYFilter, "*")
' End If
If strCriteria = ("Entity_Name = '*'") Then
Me.Filter = ""
Me.FilterOn = False
Else
If strCriteria <> "" Then
Me.Filter = strCriteria
Me.FilterOn = True
End If
End If
结束功能
返回的strCriteria是 Entity_Name ='*'AND分配='MFI'
过滤器不起作用,并且Entity_Name全部为空。我在做什么错了。
我正在MS-Access中使用它,并在VBA中构建查询
答案 0 :(得分:0)
我会这样
HashMap<String, String> map = new HashMap<String, String>();
for(Data data: dataArray){
map.put("id", String.valueOf(data.getId()));
map.put("product_id",String.valueOf(data.getName()));
}
如果未选择任何组合框或文本框,则会忽略这些字段。