简体   繁体   English

在Access数据库中使用复选框和组合框查询

[英]Query with checkbox and combobox in Access Database

Good afternoon This is my query: 下午好,这是我的查询:

SELECT Reference.quote_date AS [Quote Date]
  , Reference.agent_ID AS Agent
  , Reference.ref_ID AS ReferenceID
  , Reference.ref_number AS [Ref Number]
  , Customer.title_id AS Title
  , Customer.name AS Name
  , Customer.surname AS Surname
  , Customer.postcode AS Postcode
  , Customer.telephone AS Telephone
  , Reference.location_ID AS Location
  , Reference.policy_ID AS Product
  , Reference.price AS Price
  , Reference.status_ID AS Status
  , Reference.source_ID AS Source
  , Reference.calltype_ID AS [Call Type]
  , Reference.prize_draw AS [Prize Draw]
  , Reference.Call_back_date AS [Call back date]
  , Reference.call_back AS [Call back]
  , Reference.IsCompleted AS Completed
  , Reference.comments AS Comments
FROM Customer INNER JOIN Reference 
  ON Customer.[customer_ID] = Reference.[customer_ID]
WHERE (((Reference.agent_ID)=[Forms]![Call_Back_Search1]![Combo5]) 
  AND ((Reference.Call_back_date) 
    Between [Forms]![Call_Back_Search1]![StartDateTxt] And [Forms]![Call_Back_Search1]![EndDatetxt]));

It Currently shows all call backs within certain criteria selected in Call_Back_Search1 form: - date criteria: between Start and date:End - and allows to select the Agent (Combobox05). 当前,它显示在Call_Back_Search1表单中选择的某些条件内的所有回叫:-日期条件:在开始和日期之间:-允许选择座席(Combobox05)。 I wish to add additional criteria to my query : 我希望在查询中添加其他条件:
checkbox called "Completed" to be not ticked - to show results based only on date range selected (leaving combobox blank) 不打勾的“已完成”复选框-仅根据所选日期范围显示结果(组合框为空白)
Wonder if I can ask you for any suggestions Thank you 不知道我是否可以向您提出任何建议,谢谢

I hope someone will find my answer useful Code is listed below : 我希望有人会发现我的答案有用的代码如下:

SELECT Reference.quote_date AS [Quote Date], Reference.agent_ID AS Agent, Reference.ref_ID AS ReferenceID, Reference.ref_number AS [Ref Number], Customer.title_id AS Title, Customer.name AS Name, Customer.surname AS Surname, Customer.postcode AS Postcode, Customer.telephone AS Telephone, Reference.location_ID AS Location, Reference.policy_ID AS Product, Reference.price AS Price, Reference.status_ID AS Status, Reference.source_ID AS Source, Reference.calltype_ID AS [Call Type], Reference.prize_draw AS [Prize Draw], Reference.Call_back_date AS [Call back date], Reference.call_back AS [Call back], Reference.comments AS Comments, Reference.IsCompleted FROM Customer INNER JOIN Reference ON Customer.[customer_ID] = Reference.[customer_ID] WHERE IIF(IsNull(Forms!Call_Back_Search1!Combo5),True,(Reference.agent_ID)=Forms!Call_Back_Search1!Combo5) And ((Reference.Call_back_date) Between Forms!Call_Back_Search1!StartDateTxt And Forms!Call_Back_Search1!EndDatetxt) And (([Reference.IsCompleted])=0) SELECT Reference.quote_date AS [报价日期],Reference.agent_ID AS代理,Reference.ref_ID AS ReferenceID,Reference.ref_number AS [Ref Number],Customer.title_id AS标题,Customer.name AS名称,Customer.surname AS姓氏,客户.postcode AS邮政编码,Customer.telephone AS电话,Reference.location_ID AS位置,Reference.policy_ID AS产品,Reference.price AS价格,Reference.status_ID AS状态,Reference.source_ID AS来源,Reference.calltype_ID AS [呼叫类型], Reference.prize_draw AS [奖赏],Reference.Call_back_date AS [回叫日期],Reference.call_back AS [回叫],Reference.comments AS注释,Reference.IsCompleted来自客户INNER JOIN客户ON。[customer_ID] =参考。[customer_ID]在哪里IIF(IsNull(Forms!Call_Back_Search1!Combo5),True,(Reference.agent_ID)= Forms!Call_Back_Search1!Combo5)和((Reference.Call_back_date)在表单之间!Call_Back_Search1!StartDateTxt和Forms!Call_Back_txt并且(([[Reference.IsCompleted])= 0) ; ;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM