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
10 10760
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
-
'Set to General Search - Part of Field
-
Application.SetOption "Default Find/Replace Behavior", 1
-
-
'do whatever you like in here, but Reset Option at some point
-
-
'Reset to Fast Search - Whole Field
-
Application.SetOption "Default Find/Replace Behavior", 0
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: - 'Define global variable
-
Public intEntryBehavior As Integer
-
-
'Get original setting
-
intEntryBehavior = Application.GetOption("Behavior Entering Field")
-
-
'Set option you want
-
Application.SetOption "Behavior Entering Field", 1
-
-
'Reset to original setting
-
Application.SetOption "Behavior Entering Field", intEntryBehavior
-
Linq ;0)>
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: - 'Define global variable
-
Public intEntryBehavior As Integer
-
-
'Get original setting
-
intEntryBehavior = Application.GetOption("Behavior Entering Field")
-
-
'Set option you want
-
Application.SetOption "Behavior Entering Field", 1
-
-
'Reset to original setting
-
Application.SetOption "Behavior Entering Field", intEntryBehavior
-
Linq ;0)>
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.
These Key Sequences seem to work fairly well: -
Screen.PreviousControl.SetFocus
-
SendKeys "{TAB 2}": SendKeys "{UP 2}"
-
SendKeys "+{TAB 2}"
-
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
What version of Access are you running? Your code doesn't work for me in ACC2003. But like I said, I had other SendKeys code that worked sometimes and didn't work at other times. There's nothing else that has to be set for SendKeys to work, is there?
Linq ;0)>
What version of Access are you running? Your code doesn't work for me in ACC2003. But like I said, I had other SendKeys code that worked sometimes and didn't work at other times. There's nothing else that has to be set for SendKeys to work, is there?
Linq ;0)>
Ironically enough, it was tested in Access 2003.
As John Walton was wont to say, "Life's a mystery!"
Linq ;0)>
Thanks a ton to ADezii and missinglinq....
It made my life easy...
it works as said by you guys.
Thanks and regards,
Shaq
As John Walton was wont to say, "Life's a mystery!"
Linq ;0)>
Was this the same John Boy Walton of The Waltons (LOL)?
Nope! Was his daddy!
Linq ;0)> Sign in to post your reply or Sign up for a free account.
Similar topics
by: AA Arens |
last post by:
When I place a record serch utility (vos the button placement wizzrd),
I discovered that the Match setting is "Whole Field" by default. How to
make "Any Part Of Field" default?
|
by: Marty |
last post by:
Hi,
I would like to replace "\r\n" by "_" within a specific string.
I tried :
strMyString.Replace('\r', '_');
strMyString.Replace('\n', '_');
or...
|
by: nan |
last post by:
Hi All,
I am trying to connect the Database which is installed in AS400
using DB2 Client Version 8 in Windows box.
First i created the Catalog,
then when i selected the connection type...
|
by: Louis |
last post by:
I have a problem using the REPLACE method. Here is a short description:
In a.html:
I used the following to call the chgtitle function:
<a href=" "...
|
by: Jon |
last post by:
If anyone can help...Whenevr I go into a form and use the ctrl+F to
find something with the binoculars the "Search field as formatted" is
checked as default. This seems to slow down the find...
|
by: Rave |
last post by:
This is a long shot, but I thought I'd try it. I am currently using excel as an inventory tool. I currently have a hand-held scanner plugged into a laptop for reading barcodes. Using the "Find and...
|
by: John Nagle |
last post by:
I'm trying to clean up a bad ASCII string, one read from a
web page that is supposedly in the ASCII character set but has some
characters above 127. And I get this:
File...
|
by: Winks |
last post by:
In the 2003 version I was able to change the default "Look In" and
"Match" settings for the Find dialog box. I have looked all over 2007
and cannot find where to set the defaults.
Can anyone...
|
by: matthardwick |
last post by:
Is there a way to make the find box (Ctrl+F) default to match "Any part of field" instead of "Whole field".
Thanks in advance.
Matt.
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |