在“失去焦点”时,子工作但不是“改变” [英] Sub works when on "lost focus" but not on "change"

查看:49
本文介绍了在“失去焦点”时,子工作但不是“改变”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个可以在丢失焦点事件中使用时工作正常的子程序,但是当我尝试使用与更改事件相同的子时,我得到了上述错误。


我已经在网上搜索并发现了很多信息,但没有我可以使用的信息。


我肯定我错过了一些基本的东西所以道歉如果这是一个小学生的错误!


这一切都适用于Acess 2003表格。我正在寻找创建即时搜索,检查输入到表格的文本框中的数字以返回名称。使用丢失焦点事件时它可以正常工作,但这意味着用户必须单击关闭以查看搜索结果。正如我正在使用的Dlookup是即时的,每次在这个文本框上按键时,它都不会减慢运行子表单的速度。


我''我错过了一些基本的东西,因为只是将事件更改为更改是在以前没有任何事情时抛出语法错误。


这里是代码,因为它是,谢谢你任何帮助:

Hi everyone, I have a sub that works fine when used with the lost focus event, but when I try and use the same sub with the change event I get the above error.

I''ve searched the net and found lots of information but none of it that I can use.

I''m sure I''m missing something basic so apologies if it''s a schoolboy error!

This all applies to an Acess 2003 form. I''m looking to create an instant search that checks a number entered into a text box against a table to return a name. It works fine when the lost focus event is used but this means the user has to click off to see the outcome of the search. As the Dlookup I''m using is instant it won''t slow down the form to run the sub every time there is a key press on this text box.

I''m missing something basic though because just changing the event to change is throwing out syntax errors when previously there weren''t any.

Here''s the code as it is, thanks for any help:

展开 | 选择 | Wrap | 行号

推荐答案

你说你得到了上述错误,但你从来没有发布了任何错误代码。
You said you get the above error but you never posted any error code.


对不起,我的浏览器崩溃了,我把它粘贴回来了。我一定错过了错误部分。


它的运行时3075.它说有一个语法错误在查询表达式''[Personnel Number] =''中。


在调试时突出显示Dlookup。
Sorry, my browser crashed and I was pasting this back in. I must have missed the error part.

Its runtime 3075. It says there is a syntax error in the query expression ''[Personnel Number]=''.

It highlights the Dlookup when it debugs.


它显示为什么调试器中的值?
What does it show as the value in the debugger?


这篇关于在“失去焦点”时,子工作但不是“改变”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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