parry
MrExcel MVP
- Joined
- Aug 20, 2002
- Messages
- 3,355
Hi, I want to change the default settings for the in built Access find function.
What I would like is the default to be as follows:-
LookIn = current field that has focus
Match = Any Part of Field
Under Tools|Options|Edit/Find there are options but they dont do the combination I want. Fast search does the LookIn piece fine but puts the option of Whole Field as the match, while General Search has the match fine but puts the current record (rather than all records) in the LookIn.
This is an annoyance as I have to change the LookIn or Match every time I want to do a search for the first time in the database.
I wrote the following code which doesnt quite do it as it doesnt carry onto the next record. What I would prefer is to change the native Find options - API call?
cheers
Parry
What I would like is the default to be as follows:-
LookIn = current field that has focus
Match = Any Part of Field
Under Tools|Options|Edit/Find there are options but they dont do the combination I want. Fast search does the LookIn piece fine but puts the option of Whole Field as the match, while General Search has the match fine but puts the current record (rather than all records) in the LookIn.
This is an annoyance as I have to change the LookIn or Match every time I want to do a search for the first time in the database.
I wrote the following code which doesnt quite do it as it doesnt carry onto the next record. What I would prefer is to change the native Find options - API call?
cheers
Parry
Code:
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click
Dim SearchValue
Forms!form1!title.SetFocus
SearchValue = InputBox("Enter Game Title")
If SearchValue = "" Then Exit Sub 'User pressed Cancel or didnt enter a title
DoCmd.FindRecord SearchValue, acStart, False, acSearchAll, False, acCurrent, True
If InStr(1, Forms!form1!title.Value, SearchValue, vbTextCompare) = 0 Then
MsgBox "Record not found"
End If
Exit_cmdFind_Click:
Exit Sub
Err_cmdFind_Click:
MsgBox Err.description
Resume Exit_cmdFind_Click
End Sub