更改我的搜索按钮 [英] Changing my Search Button

查看:46
本文介绍了更改我的搜索按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,允许我按Id号搜索客户端 - 但我们现在希望按客户名称搜索,最好是Surname&名字。我已经去过这个&可以调整代码来搜索姓氏,但这只会带来第一条记录。是否可以轻松更改此代码,以便我们可以搜索First Name&姓氏(或姓氏名字)或新代码会更好。我该怎么做?任何帮助都会很棒


使用Windows XP& Access 2000

I have the following code which allows me to search for a client by Id Number -- however we now wish to search by client name preferably Surname & First name. I have had a go at this & can adapt the code to search on Surname but this will only bring up the first record. Is it going to be easy to change this code so that we can search on First Name & Surname (or Surname First Name) or would new code be better. And how would I do this? Any help would be great

Am using Windows XP & Access 2000



展开 | 选择 | Wrap | 行号

推荐答案

看看此示例数据库: http://allenbrowne.com/AppFindAsUType.html 。除此之外: http://allenbrowne.com/ser-62.html


可以调整代码,但是你可能会发现这些样本中使用的方法更直观一些......而不是单击命令按钮,第一次搜索基于输入时输入的文字。


问候,

Scott
Have a look here at this sample database: http://allenbrowne.com/AppFindAsUType.html. As well as this one: http://allenbrowne.com/ser-62.html

Adapting your code is possible, but you might find the methods used in these samples a little more intuitive... Instead of clicking a command button, the first searches based on text entered while you are typing.

Regards,
Scott


感谢您的帮助 - 尽管有一个快速看看他们,他们可能有点复杂,我们需要什么。我确实设法改变我的代码来搜索客户姓氏和&这是好的,除了它只拿起第一条记录。如果我能够调整它来获取所有带有该姓氏的记录,它可能会完成这项工作
Thanks for your help - although having had a quick look at them they are maybe a bit to complex for what we need. I did manage to change my code to search for client surname & that was ok except it only picked up the first record. If I could adapt that to pick up all of the records with that surname it would probably do the job


调整代码的一个问题是你的代码正在寻找一个独特的标识符,只会返回一个结果。更改唯一标识符以在Surname字段中查找将执行以下操作:返回一个结果。


您可以使用VBA中的DoCmd.RunSQL方法运行SQL查询。就在我的脑海中,尝试这样的事情:
One of the problems adapting the code you have is that your code is looking for a unique identifier, and so will only be returning one result. Changing the unique identifier to look in the Surname field will do what you are finding: return one result.

You can run an SQL query using the DoCmd.RunSQL method in VBA. Just off the top of my head, try something like this:
展开 | 选择 | Wrap | 行号


这篇关于更改我的搜索按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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