
passing forms and controls so I can set focus back to a form from a module
Nice easy one for you...
The LostFocus event calls sub textSize as shown below. I need to pass the
control and form so that the sub gets them like this frmX.txtX
not as a string, so it can perform this task:
frmX.txtX.setfocus
how do you do that. what do I dimension the parameter as?
this is a generic string length checking routine and has to work on over 100
fields...
thanks in advance
Private Sub TxtTitle_LostFocus()
textSize Len(TxtTitle), 20, frmTitle, "New Title:" ', TxtTitle need
to pass the control not its text !
End Sub
Sub textSize(actLength, rightLength As Integer, myForm As Form, name As
String)
',
myControl As Integer stick this in the brackets
'used to validate textboxes do not contain too many characters
If actLength > rightLength Then
MsgBox ("The text entrered in " & name & " must be no longer than " &
rightLength & " characters")
Stop
'in here, I want to set focus to form.control passed in as what?
'WHAT CAN I PUT HERE.SetFocus
'Stop
End If
End Sub