查找和替换为默认“字段的一部分”的代码 [英] code for Find and Replace to default "a part of field"

查看:73
本文介绍了查找和替换为默认“字段的一部分”的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,我可以在按下按钮时激活搜索和替换对话框。


我的问题是对话框打开了默认它应该

只搜索完整匹配,我希望它以默认的

字段的一部分打开。


我确实通过转到工具 - >将其更改为默认字段的一部分?

选项菜单打开选项按钮对话窗口。选择编辑/查找按钮标签。选择常规搜索选项按钮。


但是当我将其交给任何其他测试或用户时,它再次默认为整个字段。我不能要求用户在最后更改它。


任何1个人都可以帮我一些可以为我做这个的代码。

它在哪里默认为字段的一部分对于将使用此应用程序的所有用户。


提前感谢。


Shaq

I have a form, where I can activate the search and replace dialogbox when
pressing a button.

My problem is that the dialogbox opens with the default that it should
search for full match only, and I want it to open with default "a part of
field".

I did change it to default "A part of the field"?
by going to Tools -> Options menu to open the "Options" dialog window. Select the "Edit/Find" tab. Select the "General Search" option button.

But when I give this to any 1 else to test or for users it again defaults to "Whole field". I cant ask the users to change it at there end.

Can any 1 pls help me with some code which can do this for me.
Where it defaults to "a part of field" for all users who will use this application.

Thanks a ton in advance.

Shaq

推荐答案

在另一个帖子中查看此链接以获取此问题的答案:
http://www.thescripts.com/forum/thread201087.html
see this link for answers for this question in another thread:
http://www.thescripts.com/forum/thread201087.html



我有一个表格,我可以

按下按钮时激活搜索和替换对话框。


我的问题是对话框打开时默认情况下它应该是

仅搜索完整匹配,我希望它以默认

字段的一部分打开。


我确实将其更改为默认值通过工具 - >字段的一部分?

选项菜单打开选项按钮对话窗口。选择编辑/查找按钮标签。选择常规搜索选项按钮。


但是当我将其交给任何其他测试或用户时,它再次默认为整个字段。我不能要求用户在最后更改它。


任何1个人都可以帮我一些可以为我做这个的代码。

它在哪里默认为字段的一部分适用于所有使用此应用程序的用户。


提前付款。


Shaq
I have a form, where I can activate the search and replace dialogbox when
pressing a button.

My problem is that the dialogbox opens with the default that it should
search for full match only, and I want it to open with default "a part of
field".

I did change it to default "A part of the field"?
by going to Tools -> Options menu to open the "Options" dialog window. Select the "Edit/Find" tab. Select the "General Search" option button.

But when I give this to any 1 else to test or for users it again defaults to "Whole field". I cant ask the users to change it at there end.

Can any 1 pls help me with some code which can do this for me.
Where it defaults to "a part of field" for all users who will use this application.

Thanks a ton in advance.

Shaq

展开 | 选择 | Wrap | 行号


我尝试使用这种代码来改变Access的一个默认行为(不记得哪一个,不在乎)和遇到同样的问题,我想,你会在这里;在Access关闭然后重新打开之前,对查找/替换的默认行为的更改不会生效。虽然您可以使用它来更改默认值,但在下次打开Access之前它不会生效,您无法使用代码重置行为。在原始会话中最后执行的设置是将在下一个会话中出现的设置。


我理解OP不想更改用户计算机上的默认行为,但我真的没有办法解决这个问题。我曾经使用SendKeys进行黑客操作,但是它太错误了(就像SendKeys一样)我停止使用它。它可能更好地让用户知道他们需要更改此设置而不仅仅是用代码更改它,但实际上,很可能甚至不知道它存在!


另一件事是,即使代码按预期工作,你也只会猜测用户最初的默认设置是什么。它可能已被设置为找到任何部分。你会改变它,这是不可取的。解决此问题的方法是,在不关闭/打开Access的情况下更改生效的默认值,使用GetOption属性,将其分配给全局变量(Integer数据类型)并使用它来重置默认值。

行为输入字段是一个默认立即生效:

I tried using this kind of code to change one of Access'' default behaviors (don''t remember which one, off hand) and ran into the same problem, I think, that you''ll have here; changes to the Default behavior of Find/Replace don''t take effect until Access is closed and then reopened. While you can use this to change the default, it won''t take effect until the next time Access is opened, and you can''t really use the code to reset the behavior. Whichever setting is executed last in the original session is the one that will appear in the next session.

I understand the OP''s not wanting to change the Default behavior on users machines, but I don''t really see a way around that. I used to have a hack using SendKeys to do this, but it was so buggy (as SendKeys tends to be) I stopped using it. It''s probably better letting the users know that they need to change this setting than to merely change it with code, but in reality, most probably don''t even know it exists!

The other thing is that even if the code worked as desired, you''d only be guessing at what the user originally had the default set to. It could have already been set to "find any part" and you''d be changing it, which isn''t desirable. The way around this, for changing defaults that do take effect without closing/opening Access, is to use the GetOption property, assign it to a global variable (of Integer Datatype) and use it to reset the default.

Behavior Entering Field is one such default that takes effect immediately:

展开 | 选择 | 换行 | 行号


这篇关于查找和替换为默认“字段的一部分”的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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