Is it possible to make a macro to change the default setting for the built-in Find/Next method from "Match: Whole Field" to "Match: Any part of Field"?
I doubt a macro can do it, but I guess VBA can.
Sorry that I cannot contribute more, I've also wondered about this..
Another sollution is to use filters and make your own search-form. More work probably, but it looks more integrated (if you are good on design, that is)..
Anywhere where you wish to trigger it;-)
Forms module, standard module...
Point is, I think you'll need to restart Access for a change to take place (or it might just be me not knowing how to refresh such properties), so where you place it might not be so important. But perhaps in the on open event of the first form opening in the database?
1. enter design view of the form
2. draw the commandbutton (or image, if preferred)
3. right-click the button or image
4. click on the properties
5. go on the action pane (not sure if it's called action)
6. press the textbox where it says "on click". When you see that two buttons on the right appears, click on the one with an arrow pointing downwards, choose the [action] or what it's called.. Not sure about the english term.
7. press the "..." button next to the button on point 6.
8. paste the code
To test the code, press first [CTRL] + to store the VBA, then switch back to access ([ALT] + [TAB]), press the button you pressed to enter designview.. eg. enter normal-mode for the form.
You dont need to restart access..
if you get an error in your code, try to fix it, and then press [F5] in VB.
There is no reason to close VB, untill you are done for the day. More VBA is often needed.
remember to comment your code, as well as ident it!
identing should be like this:
' comment about what this code does
IF something THEN
foo ' comment about foo
ELSE
bar ' comment about bar
END IF
This makes the code easier to read.
Do not comment too much, do not comment too little..
example:
' check for error
IF error = "true" THEN
msgbox("Error!") ' alert user
ELSE
msgbox("no problem mate!") ' run regular code
END IF
eg. your comments does not have to tell in detail what happends!
One important tip:
When you work with text-fields, (searching, modifying, etc), you always have to use the .setfocus!
eg. before searching, set the focus to the first textfield you want it to be able to search thru.
Just for information, I here past my search-code.. I use images instead of buttons (custom images, so design looks better). Also I have a tip field, a bunny, which talks the tips in dialouges. It's based on a global variable (defined in (General))
I just implemented RoyVidar's function too.. works perfect
anyways, here is the code.. use if you want
ps. if you want to use a tip-field, like I do, remember to reset the code, when the mouse moves over the form or any objects.
You just paste this code in all the objects:
knappInfo = "your tiptext"
If lblInfo.Caption <> knappInfo Then lblInfo.Caption = knappInfo
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.