Wild card based on combo box not working

喜夏-厌秋 提交于 2020-01-06 13:58:47

问题


I've got a criteria within a query, can't quite get it to work:

IIf([Forms]![Reports]![Office Filter]<>"View all offices",[Forms]![Reports]![Office Filter],"LIKE '*'")

The purpose of the query is to check if an office is selected. If so, the criteria should be set to that office. If not, i.e. if "View all offices" is selected from the combobox on the Reports form, it should show all records.

The query works fine if an office is selected, but returns no records if "View all offices" is selected. I've tried putting this term in as a separate expression to check that it's working - at least as far as returning Like '*' in the expression when "View all offices" is selected.

Any clue as to what I'm doing wrong? Thanks in advance.


回答1:


Try this instead:

WHERE ([Forms]![Reports]![Office Filter]="View all offices") OR (OfficeField=[Forms]![Reports]![Office Filter])


来源:https://stackoverflow.com/questions/5674119/wild-card-based-on-combo-box-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!