如何创建高级搜索表单? [英] How do I create an advanced search form?

查看:101
本文介绍了如何创建高级搜索表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个搜索表单,以便我可以使用*等通配符搜索员工,然后可以选择其中一个结果并转到该员工的记录。它将搜索以Doe,John A形式的整个名称字段。我希望能够搜索*,John并找到名字为John的所有人或搜索Doe,*并找到姓氏的所有人是Doe。


我正在使用Access 2010

解决方案

首先,全名永远不会存储在单个字段中 - 这违反了数据库规范化规则。如上所述,您可以使用文本框(txtPartial),用户可以在其中输入全部或最后的部分全名。然后,列表框将在[全名]字段中包含在txtPartial中输入的值的所有可能匹配。然后,您可以在列表框中选择一个条目,因为Unique [ID]字段;可以打开一个表单,仅显示该记录。一般来说,逻辑发布如下:

展开 | 选择 | Wrap | 行号


Hi Seth。


使用现代数据库的要点之一是你永远不会尝试你所要求的。如果您希望某个字段中的数据与同一字段中的任何其他数据区别对待,则它应位于单独的字段中。您可以随时使用连接在一起的数据,但将数据存储在一起时将数据分开是一种只会导致您遇到麻烦的方法。


所有这些说明,您可以非常轻松地过滤数据一个数据库。 表单上的示例过滤级联表单过滤可以帮助您完成基本概念,并且应该为您提供所需的一切。


好吧,我们的主要工作数据库(这是一个巨大的,当然是一个现代数据库)有这个功能,我的老板想要我正在创建的数据库中的这个功能。我有一个全名字段的原因是我用它来填充组合框。我知道我可以在组合框中组合名字和姓氏字段,但是它们彼此分开以便为大名字腾出空间。如果你知道解决这个问题的方法,我会用它,但这是我所知道的唯一方法。我确实有名字和姓氏字段以及整个名字字段。


我会查看你提供的链接,看看我能用我的个别字段做些什么。

I''m wanting to create a search form so that I can search for employees using wildcards such as * and then be able to select one of the results and go to that employee''s record. It will be searching a whole name field that is in the form of Doe, John A. I want to be able to search for *, John and find everyone whose first name is John or search for Doe, * and find everyone whose last name is Doe.

I''m using Access 2010

解决方案

First and foremost, a Whole Name should never be stored in a single Field - this defies the Rules of Database Normalization. The above being strongly stated, you can have a Text Box (txtPartial) into which the User can enter a Partial Whole name either First or Last. A List Box will then contain all possible Matches in the [Whole Name] Field for the Value entered in txtPartial. You can then select an entry in the List Box and because of the Unique [ID] Field; a Form can be opened displaying only that Record. The Logic, in general, is posted below:

Expand|Select|Wrap|Line Numbers


Hi Seth.

One of the main points about using a modern database is that you never attempt what you are asking for. If you want data within a field to be treated differently from any other data in the same field, then it should be in a separate field. You can always use the data joined together, but separating the data when stored together is an approach that will only lead you into trouble.

All that said, you can filter data very easily within a database. Example Filtering on a Form and Cascaded Form Filtering can help you with the basic concepts and should give you all you need.


Well, our main database for work (which is huge and is certainly a modern database) has this feature and my boss wants this feature in the database that I''m creating. The reason that I have a whole name field is that I use it to populate combo boxes. I know that I can combine first and last name fields in the combo box, but then they are way separated from each other to make room for big names. If you know of a way around this, I would use it, but it is the only way that I know of. I do have first and last name fields as well as the whole name field.

I will look into the links that you provided and see what I can do with my individual fields.


这篇关于如何创建高级搜索表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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