Hi
I'm trying to slim down my code and save my fingers....
I have various forms with multiple text boxes. I want some code on the get focus event that will select whatever text happens to be in the box.
In the past I have used...
But with the number of boxes I have, I need to make a call to a simple module... I have this so far....
In the get focus event of each text box I have...
In a module I have....
This gives me a type 13 Mismatch error. Where have I gone wrong???
Any Help appreciated
I'm trying to slim down my code and save my fingers....
I have various forms with multiple text boxes. I want some code on the get focus event that will select whatever text happens to be in the box.
In the past I have used...
Code:
Private Sub [i]txtBoxName[/i]_GotFocus()
[i]txtBoxName[/i].SelStart = 0
[i]txtBoxName[/i].SelLength = Len([i]txtBoxName[/i].Text)
End Sub
But with the number of boxes I have, I need to make a call to a simple module... I have this so far....
In the get focus event of each text box I have...
Code:
Private Sub txtBoxName_GotFocus()
SelectAllTxt (Me)
End Sub
Code:
Public Sub SelectAllTxt(txtBox As Control)
txtBox.SelStart = 0
txtBox.SelLength = Len(txtBox.Text)
End Sub
This gives me a type 13 Mismatch error. Where have I gone wrong???
Any Help appreciated