Find Options

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

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
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,221,572
Messages
6,160,575
Members
451,656
Latest member
SBulinski1975

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top