同时搜索多个字段以查找特定范围内的值 [英] Search multiple fields simultaneously for values within a certain range
问题描述
您好,我第二次回到这个论坛,我想感谢您提供的大力帮助。我现在遇到了一个新问题,希望你能再次帮助我。
我正在MSAccess07中实施一个容器监控系统而我正在使用多重搜索功能对容器进行排序。我使用了几个未绑定的文本框和一个列表框。用户在一个或多个文本框中键入部分搜索条件。或者,如果他们不输入任何内容,则返回所有记录。匹配在列表框中返回。
我将显示1个文本框的代码,以显示它是如何工作的。
这是搜索按钮的代码:
Hi there, I''m returning to this forum for the second time and I would like to say thanks for the great help provided. I''ve encountered a new problem now and hope that you will be able to help me again.
I''m currently implementing a container monitoring system in MSAccess07 and I''m using a multiple search function to sort containers. I use several unbound text boxes and a list box.The user type''s in partial search criteria in one or several text boxes. Or if they don''t key in anything it returns all records. The matches are returned in a listbox.
I will show the code for 1 text box just to show how it works.
This is the code for the search button:
推荐答案
搜索落入的记录在指定的日期范围内,使用BETWEEN运算符确保使用#限定符分隔日期字段。假设输入[txtBeginDate]和[txtEndDate]的字段,一般逻辑将是:
To search for Records falling within a specified Date Range, use the BETWEEN operator making sure to delimit the Date Fields with the ''#'' qualifier. Assuming entry Fields of [txtBeginDate] and [txtEndDate], the general logic would be:
感谢您的关注。是的,是否可以将您给我的示例合并到现有代码中?我的意思是,我可以使用各种标准进行搜索,例如按照01/01/2008和01/02/2008之间的日期范围对数据进行排序,以及其他一些数据,例如容器大小。
我真的希望我是很清楚。不幸的是,我现在没有机会测试你的例子,但是我要在早上做第一件事并通知你结果。
谢谢你再次;)
Thanks for your attention. Right, is it possible to incorporate the example u gave me into the existing code? I mean so that I would be able to make searches using various criteria e.g. sort the data by the date range between 01/01/2008 and 01/02/2008 and some other piece of data like container size for instance.
I really hope I''m being clear. Unfortunately I don''t have a chance to test ur example right now, but I''m going to do that first thing in the morning and inform u of the results.
thank u again ;)
感谢您的关注。是的,是否可以将您给我的示例合并到现有代码中?我的意思是,我可以使用各种标准进行搜索,例如按照01/01/2008和01/02/2008之间的日期范围对数据进行排序,以及其他一些数据,例如容器大小。
我真的希望我是很清楚。不幸的是,我现在没有机会测试你的例子,但是我要在早上做第一件事并通知你结果。
谢谢你再次;)
Thanks for your attention. Right, is it possible to incorporate the example u gave me into the existing code? I mean so that I would be able to make searches using various criteria e.g. sort the data by the date range between 01/01/2008 and 01/02/2008 and some other piece of data like container size for instance.
I really hope I''m being clear. Unfortunately I don''t have a chance to test ur example right now, but I''m going to do that first thing in the morning and inform u of the results.
thank u again ;)
代码已经过测试,并且在给定现有参数的情况下似乎运行良好。
Code has been tested, and seems to work quite well, given the existing parameters.
这篇关于同时搜索多个字段以查找特定范围内的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!