Hi Guys,
Despite the fact Access VB is not object-oriented-programming friendly, I struggle to do as much as possible with usage of class modules. That's why I created clsSearch class to handle search events on different forms. I'm creating new instance of clsSearch on form_open and remove it on form_close event. The instance is a private object of the form for which it's supposed to handle search events. The problem I have now is that I want to reassing ctrl+F to be handled by my object. This is not a problem on the main form, I just put:
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Call srch.replaceCtrl_f(KeyCode, Shift)
End Sub
srch is the object and replaceCtrl_f is its method to handle ctrl+F press event.
Unfortunately, most usually main form doesn't react properly on ctrl+F as, probably, subForm is in focus and it receives KeyDown event rather than main form. My question is: how can I refer to main form's object from subform? I need to be able to trigger its replaceCtrl_f method but srch is not recognized by subform as it's main form private object.. How can I get round that?
Robert
The solution I've chosen is to make mainform's keydown event public and call it from the subform.