If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
FindMatch anywhere, FindField all - how to keep that?
Hello to all,
I made a nice database with a couple of tables, forms, etc. Most of it is ok, but one thing is driving me crazy. On every form, I made a "Search" button. The effect is equivalent to selecting "Edit - Find" in the menu. The VBA text of the button is (apart from On Error things etc.): Screen.PreviousControl.SetFocus DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70 Now, for every search that I do, I want to search anywhere (i.e. in parts of the fields, not only in the whole fields) en in all fields (i.e. not only in the current field). In the MS Access Options, you can select these settings, and so I did. Now, when I start MS Access and my database, at first this is ok: the first search has the desired options. According to the Help, these options should be used again and again, but this is simply not true. When I start a new search, suddenly, all by itself, the search options are changed to acWholeField and acCurrent, and I don't want that!! I tried to change the VBA text of the button, but I cannot find out how. It seems to me that there are two ways I could follow: 1. Keep using DoCmd.DoMenuItem. The problem then is that this command doesn't offer a chance to set the search options. 2. Use DoCmd. FindRecord. Now I can set the search options. But, in that case I also have to fill in the search term, which I don't have yet, because only when I use DoCmd.MenuItem, the search box appears in which I can fill in the term that I want to find. So I can't figure it out. In fact, rewriting the VBA text of the button is far from ideal, because I also want to be able to search, using the hot key combination Ctrl+F. It would be nice if I could link this key combination to the button, but if I am not wrong, there is no way to define a hot key for a button. Or is there? Niko |
Thread Tools | |
Display Modes | |
|
|