开发者

Wild card based on combo box not working

开发者 https://www.devze.com 2023-02-26 09:00 出处:网络
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 \'*\'\")

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开发者_C百科.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.


Try this instead:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号