Reuse default search box on Form (1 Viewer)

Babycat

Member
Local time
Today, 09:20
Joined
Mar 31, 2020
Messages
275
Dear everyone.
Is that possible to re-use the search box that appears on record navigation bar at botton of form?
It is great as it jumps to fields on current record, and jump to next record that search criteria is met.

Thank you!
 

Babycat

Member
Local time
Today, 09:20
Joined
Mar 31, 2020
Messages
275
What do you mean by ‘reuse’
I meant I wanna add a text box on my form's header that has exactly same function to that default search box
 

CJ_London

Super Moderator
Staff member
Local time
Today, 03:20
Joined
Feb 19, 2013
Messages
16,616
OK you can't 'reuse' the control, but you can create an equivalent using vba.

However the vba will be complex. If you want to give it a try you will need an unbound control in your form

then code that loops through each control, stopping when it finds a match and continuing on to the next record, stopping on the next matching control. When it gets to the end of the recordset, it returns to the beginning and continues until it gets to the starting record. (or you just start from the first record anyway)

On each matched control you need to set the focus and get the selstart and sellength of the matched text to highlight it

The code would be triggered by the search textbox keydown or keyup event (not sure which without testing) which detects if the user has hit the return key
 

Users who are viewing this thread

Top Bottom