I have a form with over 500 text boxes on it.
When I double click one of them I have a procedure tied to the On Dbl Click event.
What I want to happen is to have that same code (albiet with different variables passed) run no matter which of the 500 text boxes I double click.
The only way I know how would be to write 500 Private Sub DblClick(Cancel as integer)
procedures.
That would work but there must be another way surely.
I don't like the idea of having basically the same code copied 500 times just so one instance is pointing to one of the 500 text boxes.
Copy the below code to ms-access form. If any of the textbox is double clicked it will call the doubleClick
function.
Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me
If ctl.ControlType = acTextBox Then
ctl.OnDblClick = "=doubleClick()"
End If
Next ctl
End Sub
Function doubleClick() As String
MsgBox "function called"
End Function