Call text box onExit event from another form

beginner83

Registered User.
Local time
Today, 00:33
Joined
Jun 13, 2013
Messages
11
Hi All,

I was wondering if you can call a textboxes onExit event from another form?
On my form a user enters a search criteria into a text box and when they exit the textbox the results are displayed in a listbox. This form is a subform on my main form. I want to be able to call this onExit method from the main form. Is that possible? When I put in txtSearchBox_Exit, I got an error saying Sub or Function not defined.

Thanks in advance
 
Is txtSearchBox_Exit public, (remove the Private in front of the procedure/sub) ?
 
Is txtSearchBox_Exit public, (remove the Private in front of the procedure/sub) ?

Yeah I replaced Private with Public and I still get the error.

Code:
Public Sub txtProjectName_Exit(Cancel As Integer)
..
..
End Sub

This is where I try and call the method..

Code:
    Select Case Forms!frm_mainform!frm_search.Form.Frame0
        Case 4
            txtProjectName_Exit
    End Select
 
Try this:
FormName.txtProjectName_Exit

NB: Just replace FormName with the actual name of your form.
 
As I can see that txtProjectName_Exit takes in an Argument - Cancel.. So try passing that..

If it was me, I would create a Public function.. Rather than the Form's native methods.. And I would call it like..
Code:
[COLOR=Green][B]Forms("[/B][/COLOR][COLOR=Blue][B]yourFormName[/B][/COLOR][COLOR=Green][B]").[/B][/COLOR][COLOR=Blue][B]yourPublicFunctionName[/B][/COLOR][COLOR=Green][B]([/B][/COLOR][COLOR=Red][B]argumentsIfAny[/B][/COLOR][COLOR=Green][B])[/B][/COLOR]
 

Users who are viewing this thread

Back
Top Bottom