你会如何​​创建在Microsoft Access数据库是搜索只由某些领域? [英] How would you create a database in microsoft access that is searchable only by certain fields?

查看:878
本文介绍了你会如何​​创建在Microsoft Access数据库是搜索只由某些领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你会如何创建在Microsoft Access数据库,该数据库检索只有特定的领域,只有少数(必要的)文本框控制和检查形式的箱子上,所以很容易使用 - 没有难做的查询。

How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries?

例: 您在窗体上有多个文本框和几个相应的复选框,旁边的复选框,将文本框被选中时,文本框已启用,您可以通过什么被输入到所说的文本框,然后搜索

Example: You have several text boxes and several corresponding check boxes on a form, and when the check box next to the text box is checked, the text box is enabled and you can then search by what is entered into said text box

(其实我已经知道这一点,只是玩计算器危险,在这里我提出一个问题,我知道答案只是为了增加世界的编码知识!回答进来约5分钟)

(Actually I already know this, just playing stackoverflow jeopardy, where I ask a question I know the answer just to increase the world's coding knowledge! answer coming in about 5 mins)

推荐答案

这其实是pretty的大主题,充满了各种可能出现的问题。大多数中间以获取先进的书籍都将带有某种节讨论查询通过表单,那就是你有一个未绑定的形式,它允许用户选择特定的标准,并且在执行时,写在即时SQL返回匹配数据。

This is actually a pretty large topic, and fraught with all kinds of potential problems. Most intermediate to advanced books on Access will have some kind of section discussing "Query by Form," where you have an unbound form that allows the user to choose certain criteria, and that when executed, writes on-the-fly SQL to return the matching data.

在任何东西,但一台,单表的数据结构,这不是一个简单的任务,因为从SQL的条款是依赖于查询的WHERE子句中的表。

In anything but a flat, single-table data structure, this is not a trivial task because the FROM clause of the SQL is dependent on the tables queried in the WHERE clause.

有些QBF形式从我的客户端创建应用程序的几个例子:

A few examples of some QBF forms from apps I've created for clients:

  1. 查询4底层表
  2. 查询一台单一的表
  3. 查询3基础表
  4. 查询6底层表
  5. 查询2底层表
  1. Querying 4 underlying tables
  2. Querying a flat single table
  3. Querying 3 underlying tables
  4. Querying 6 underlying tables
  5. Querying 2 underlying tables

第一个是由类模块,具有反映这种形式选择的标准性能驱动,并且具有写入FROM和WHERE子句的方法。这使得它非常容易添加其他领域(只要这些字段不来从表中不是已经包括的那些除外)。

The first one is driven by a class module that has properties that reflect the criteria selected in this form, and that has methods that write the FROM and WHERE clauses. This makes it extremely easy to add other fields (as long as those fields don't come from tables other than the ones already included).

过程中最复杂的部分是写在FROM子句,因为你必须有适当的连接类型,并仅包括无论是在SELECT子句或WHERE子句中的表。如果你有别的,你会减慢你的查询了很多(特别是如果您有任何外连接)。

The most complex part of the process is writing the FROM clause, as you have to have appropriate join types and include only the tables that are either in the SELECT clause or the WHERE clause. If you include anything else, you'll slow down your query a lot (especially if you have any outer joins).

但是,这是一个大课题,并没有什么灵丹妙药解决方案 - 相反,这样的事情必须为每个特定的应用程序创建。同样重要的是你的用户彻底测试它,因为什么是完全清楚和理解你,开发商,往往是pretty的该死的神秘给最终用户。

But this is a big subject, and there is no magic bullet solution -- instead, something like this has to be created for each particular application. It's also important that you test it thoroughly with users, since what is completely clear and understandable to you, the developer, is often pretty darned mystifying to end users.

但是,这并不仅仅适用于QBF宗旨!

But that's a principle that doesn't just apply to QBF!

这篇关于你会如何​​创建在Microsoft Access数据库是搜索只由某些领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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