Does any one know how to code this routine up to be Any Part of Field instead of Whole field on the search?
Thx
Russ
Does any one know how to code this routine up to be Any Part of Field instead of Whole field on the search?
Thx
Russ
in your criteria use this:
like * & [Enter your search value] & *
err I just realized are you talking about a query or are you trying to have it browse your actual code
the find command default value of whole field
You're not clear
Your thumbnail posted is a picture of the code in a VB window, are you trying to find something in your VB Scripting window, in a table, in a query, what?
Wait a minute I think I understand.
You have a button on a form that is invoking the find command from a toolbar and you want it to default to any part of field instead of whole field?
You can manually change it but you want to make it automatic?
I want it to be automatically part of the field not the whole field on the find.
Rus
you are still not answering my question.
I have to assume you're trying to get the innate search window to default to 'any part of field' instead of 'whole field' which can be done in versions of access prior to 2007
Click on TOOLS
Click on OPTIONS
Click on the EDIT/FIND tab
Change the DEFAULT FIND/REPLACE BEHAVIOR to GENERAL SEARCH
Running Access 2003, I will try your suggestion and let you know the results. Although, I want a pop-up find that does it. I do have easy access to the PC-s my 40 users.
That is not the solution needed yet. Two problems:
1) That did the part of a field setting, but the find box looks for the whole form not the field of focus. See pic. attached.
2) I would not want to go to every person's PC and do this setting.
I need to get those issues resolved before a roll-out.
Rus
Then don't use the default search engine.
Build your own search engine using queries with criteria of items found in your form.
Trying to adapt the default microsoft find tool is really not going be customizable.
I would think there is someone out in an Access Forum who is a geek and would have create a VBA routine to do this type of search. I have read and talked with other Access supporters looking for the Holy Grail.
If I must create the wheel can you give some pointers, I am a beginner at VBA, and a old timer at programming.
Rus
There is no holy grail for searching a database, every database is different and there is no possible way to have code interpret your database and perform the search for you.
Let's assume you want to look up a specific account number (one of the field names I can see on your form). Instead of having your form based on your entire table you could have your form based on a query and in the criteria of that query you could have
forms![your form name]![Account number search field]
Then in the ON EXIT property of your account number search field you would have
me.requery
which would update your form and bring you to the first record that matched your search criteria.
Without seeing an example of your database it's not easy to suggest where you could make your search engine work because I assume you want to search more than one field, possibly more than one field at a time too.
I have half dozen databases i support. Each with 75 screen fields, it would not be good to code a search routinue each field.
The search field is the Field of focus=where-ever the cursor is.
How about a Field of focus search routinue, like the Access find command works, but just change the parameter from whole to part.
If we could to the get the code behind the MS-find box. Or if there was a simple way to move the radio button down one to start with. Most all my users do that manually and I been asked multiple times if I could change that default. I been looking on and off for a year now, without success.
Rus
To do that you would likely have to build a SQL statement on the fly and adjust the WHERE clause to only search for those fields you want. Basing your form on a static table is not going to give you what you want. Attached is an example of what I'm talking about.