如何在表格中搜索表格然后显示结果? [英] How do you have a form search a table and then have the results displayed?

查看:92
本文介绍了如何在表格中搜索表格然后显示结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Access 2003中的程序。我有一个由五个文本框和一个搜索按钮组成的表单。我希望用户能够将搜索条件放入文本框中,当他们点击搜索按钮时,会搜索表格,并且他们应该获得与他们输入的条件相匹配的结果。到目前为止,这就是我所拥有的:

I am currently working on a program in Access 2003. I have a form that consists of five text boxes and a search button. I want the user to be able to put search criteria into the text boxes and when they hit the search button the table is searched and they should get the results that matches the criteria they entered. Here''s what I have so far:

展开 | 选择 | Wrap | 行号

推荐答案

你''已填充strFilter字符串。


您还希望使用以下内容设置过滤器:
You''ve populated the strFilter string.

You also want to set the filter with something like:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


你想要的一般都很简单,但....


这是什么''结束如果''为?它只是闲逛。


如果你每次都按照特定的顺序评估你的文本框,那么你就知道在第五个之后没有任何东西,所以为什么要''和' '附在最后。你可以随时检查它是否在那里然后是必要的东西。


然后一旦你有了你的字符串,那就太棒了,但它看起来不像你做的那样任何事情。你似乎正在做的就是设置一个字符串变量。你不能从其他模块中引用它,因为它是在程序中声明的,这意味着它的范围仅限于程序。
What you want is pretty simple in general, but....

What is that ''End If'' for? It''s just hanging out.

If your evaluating your text boxes in a specific order every time then you know that nothing comes after the 5th one so why have the ''And'' attached to the end. You can always check if it''s there and then something if necessary.

Then once you have your string, that''s great, but it doesn''t appear your doing anything with. All you appear to be doing is setting a string variable. You can''t refer to it from other modules because it''s declared within the procedure which means it''s scope is confined to the procedure.


Hi Steven,

当我添加该代码并运行程序时,我收到错误。
Hi Steven,

When I add that code and run the program I get an error.


这篇关于如何在表格中搜索表格然后显示结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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