【问题标题】:Combo Box Query to show all records组合框查询以显示所有记录
【发布时间】:2019-11-01 10:05:05
【问题描述】:

我有多个组合框,其中一个查询一个接一个地过滤(向下钻取),最后一个组合框选择通过子查询显示记录。

我担心的是,如果我没有选择任何组合框(空白),结果是空白。如何将默认值更改为 * 而不是空白?

我遵循了 StackOverflow 的其他建议,但没有成功。 我尝试将组合框值设置为Like "*"like <combo-box> & "*",但它不起作用。

非常感谢所有建议。

在我的代码中,我正在检查组合框是否为空,然后 * 否则使用组合框选择:

在我的查询中:

Field = Customer
Table = tblCustomer
Criteria = IIf(IsNull([Forms]![frmRSC]![cboCustomer]),[Forms]![frmRSC]![cboCustomer] Like "*",[Forms]![frmRSC]![cboCustomer])

【问题讨论】:

    标签: vba ms-access


    【解决方案1】:

    诀窍是在条件中使用控制值,例如查询字段:

    WHERE (Customer = [Forms]![frmRSC]![cboCustomer] OR [Forms]![frmRSC]![cboCustomer] IS NULL)
    

    如果[Forms]![frmRSC]![cboCustomer]is Null(空 ComboBox 的值),则表达式为真。

    Show All Records if Form Control is Left Empty

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-24
      • 2015-01-26
      相关资源
      最近更新 更多