Solved not show msgbox

theinviter

Registered User.
Local time
Today, 14:43
Joined
Aug 14, 2014
Messages
251
Dears
kind support for below code, as i do not want to show the message.
how can modify it.
On Error GoTo Err_LimitChange
' Purpose: Limit the text in an unbound text box/combo.
' Usage: In the control's Change event procedure:
' Call LimitChange(Me.MyTextBox, 12)
' Note: Requires LimitKeyPress() in control's KeyPress event also.

If Len(ctl.Text) > iMaxLen Then
MsgBox "Truncated to " & iMaxLen & " characters.", vbExclamation, "Too long"
ctl.Text = Left(ctl.Text, iMaxLen)
ctl.Scan = iMaxLen
End If

Exit_LimitChange:
Exit Sub

Err_LimitChange:
'MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_LimitChange

thanks
 
We have a slight conceptual disconnect here. The presence or absence of a MsgBox call has no effect on the results. The fact that you had an error is what has the effect of "code will not work." The error is triggered because the code already is not working BEFORE you call the MsgBox function. So... the next question is, what error do you get?
 

Users who are viewing this thread

Back
Top Bottom