Reputation: 464
Is it possible to totally disable search functions?
The only search facility I managed to disable was on the ribbon. But since I am using a subform, the user is able to use the search box on the navigation bar or he can press Ctrl+F to start a search.
The datasheet has 60.000 rows with 52 columns. When I start a search it takes forever.
I can disable the navigation bar, but how can I prevent the user from opening the search dialog with Ctrl+F?
Upvotes: 1
Views: 1291
Reputation: 251
If you want to disable the search function for all forms, insert a SubMacro in a macro called Autokeys, and trap CTRL+F (search) and CTRL+H (search and Replace) with ^F and ^H submacro names. As Action define a simple beep or even nothing. If you want to also avoid filtering, don't forget to set in your form properties Shortcut Menu = No
.
Upvotes: 1
Reputation: 2302
On the relevant form, set KeyPreview
property to Yes
, this causes all keys pressed to be sent to the Form_KeyDown
event before they get processed by Ms Access.
If you catch the CTRL + F key combination and process it yourself (as in my example below), it will not open the search dialog.
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyF
If (Shift And CTRL_MASK) Then
MsgBox "No search allowed!", vbCritical
End If
End Select
End Sub
Upvotes: 1