使用多个条件搜索查询 [英] Search Query with multiple criteria

查看:65
本文介绍了使用多个条件搜索查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我回来了另一个与SQL相关的问题。详细信息如下,但简而言之:我使用的是Access 2003.我有一个表,其结构可能包括每个记录四个不同的关联名称(下面的完整结构)。我有一个查询应该返回具有一个或多个输入名称(作为表单中的条件)的记录。

TableName = COMPILE_HIST

Hello all,

I''m back with another SQL related problem. The details are below, but in short: I am using Access 2003. I have a table whose structure may include four different associate names per record (full structure below). I have a query that should return records that have one or more entered names (as criteria from a form) belonging to them.

TableName=COMPILE_HIST

展开 | 选择 | Wrap | 行号

推荐答案

你试过Like" *" &安培;变量和变量" *"

它们中的任何一个都有空值吗?通配符不能用于空值。
Have you tried Like "*" & Variable & "*"
Do any of them have null values? Wildcards don''t work on nulls.



大家好,


我''回到另一个与SQL相关的问题。详细信息如下,但简而言之:我使用的是Access 2003.我有一个表,其结构可能包括每个记录四个不同的关联名称(下面的完整结构)。我有一个查询应该返回具有一个或多个输入名称(作为表单中的条件)的记录。

TableName = COMPILE_HIST
展开 | 选择 | Wrap | 行号


感谢您的链接。我可以看到表单中的搜索代码如何有用。我复制了我的表单,并根据演示更改了代码。我还添加了一些字段。用户需要能够选择一年中12个月的任意组合(我选中此选项),选择最多3个不同年份(文本框)并选择市场(仅限复选框1,2或两个选项) 。我还将表单设置为打开报表,而不是在子数据表中显示结果。


由于我添加了月份,年份和市场字段,我收到了一些VBA错误。你能救我吗?错误消息和表单的代码如下:

Thanks for the link. I can see how having the search code in the form could be useful. I copied my form and altered its code based on the demo. I added a few more fields as well. The user needs to be able to select any combination of the 12 month of the year (I made this option checkboxes), select up to 3 different years (textboxes) and select a market (checkboxes-only 1, 2, or both options). I also set the form to open a report instead of displaying the results in a subdatasheet.

Since I added the months, years, and market fields I am getting some VBA errors. Could you help me out? The error message and the form''s code are below:

展开 | 选择 | Wrap | 行号


这篇关于使用多个条件搜索查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆