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
remember to define knappInfo in (General)
Dim knappInfo As String
--
Private Sub knappSoek_Click()
On Error GoTo Err_Kommando163_Click
Application.SetOption "Default find/replace behavior", 1
Løpenr.SetFocus
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Kommando163_Click:
Exit Sub
Err_Kommando163_Click:
MsgBox Err.Description
Resume Exit_Kommando163_Click
End Sub
Private Sub knappSoek_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
knappSoek.Picture = "søk_down.bmp"
End Sub
Private Sub knappSoek_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
knappInfo = "Søk etter saker (søker ikke i tilvekst!)"
If lblInfo.Caption <> knappInfo Then lblInfo.Caption = knappInfo
End Sub
Private Sub knappSoek_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
knappSoek.Picture = "søk.bmp"
End Sub