是否可以创建搜索表单并将结果显示在特定的orde中 [英] Is it possible to create a search form and have the results appear in a specific orde

查看:71
本文介绍了是否可以创建搜索表单并将结果显示在特定的orde中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据库,它使用我们用来搜索表中记录的表单。用户可以将光标放在任何最相关的字段中,然后点击搜索按钮,该按钮将产生查找字段。对话框。当用户输入他们希望搜索的信息并按下输入时,表单将找到与该一个字段匹配的记录,并用该记录信息填充其余控件。再次按下Enter将移动到另一个满足此条件的记录,并且它将继续这样做,直到不再存在符合搜索信息的记录,然后呈现一个让用户知道的对话框。


它工作正常,但我想知道是否有任何方法使其以特定方式进行搜索。例如,大多数用户将按申请号搜索。如果我搜索请求237,它将开始如上所述的过程,但是似乎没有押韵或理由它产生结果的顺序,尽管它使用的任何订购系统,它看起来确实是一致的。我想要它做的是,使得为请求237填充的第一个结果是文件中最早的237。换句话说,我希望它使用分配日期来抓取最旧的一个。领域作为其参考点。有史以来最古老的237是目前06/26/2013。这是我想要填充的第一个。再次按回车应生成下一个最旧的,依此类推。但是,他们的订单是:

06/26/2013

10/01/2014

12/22/2014

08/15/2014

08/20/2014

12/23/2014

02/04/2015

10/03/2014

09/15/2014

如你所见,他们不合适。如果我这样搜索,搜索结果是否有任何方式按日期顺序填充?

I have a database that utilizes a form that we use to search records in the table. The user can place their cursor in any of the most relevant fields, and hit the search button which will produce a "find" dialog box. When the user inputs the information they wish to search by, and hits enter, the form will then find a record matching that one field and populate the rest of the controls with that records information. Hitting enter again will move to another record that fills this criteria, and it will continue to do so until no more records exist that fit the search information, then presenting a dialog box letting the user know.

It works fine, but what I was wondering is if there was any way to make it search in a specific fashion. For instance, most users will search by requisition number. If I search for requisition 237, it will begin the process as stated above, however there appears to be no rhyme or reason to what order it likes to produce the results in, though whatever ordering system its using, it does appear to be consistent. What I would like for it to do, is make it so that the first result that populates for requisition 237 is the oldest 237 on file. In other words, I wish for it to grab the oldest one using the "date assigned" field as its point of reference. The oldest 237 on record is currently 06/26/2013. This is the first one I want to populate. Hitting enter again should produce the next oldest one, and so on. However, the order they come up is:
06/26/2013
10/01/2014
12/22/2014
08/15/2014
08/20/2014
12/23/2014
02/04/2015
10/03/2014
09/15/2014
As you can see, they''re not in order. Is there any way for the search results to populate in order of date if I''m searching like this?

推荐答案

因为你没有发布你的代码在搜索时,很难提供任何具体的建议。


但是当您编写表单时,您可能构建了一个动态SQL字符串来进行搜索。只需更改该动态SQL字符串以包含order by子句。


此外,订单的押韵和理由是它返回结果。它是行存储在数据库文件中的顺序,或者它是正在使用的索引中的顺序,如果您使用的索引是。
Since you didn''t post your code that does the search, it''s hard to offer any specific advice.

But when you coded the form, you probably built a dynamic SQL string to do your search. Just change that dynamic SQL string to include an order by clause.

Also, there is a rhyme and reason to the order that it is returning results. It''s the order in which the rows are stored in the database file or it''s the order in the index that is being used, if you''re using an index that is.


点击代码在此图片中有以下宏编码。

The on click code has the following macro coding seen in this picture.


看不到你的附件,它被封锁了我们的防火墙。如果将它附加到线程本身更好。最好将宏转换为VBA并在代码标记之间发布代码
Can''t see your attachment, it''s blocked by our firewall. It''s better if you attach it to the thread itself. It''s best if you convert the macro to VBA and post the code here between code tags


这篇关于是否可以创建搜索表单并将结果显示在特定的orde中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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