Is Days the argument in the ValidateWorkingDays procedure? If so, Me is not
needed as it should be used in the call
With Days
.SetFocus
.SelStart = 0
.SelLength = Len(Days.Text)
End With
and
ValidateWorkingDays(Me.txtApril.Text, cancel = False)

Signature
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
> I have a form that allows users to enter working days for a month in 12 text
> boxes and I call a ValidateWorkingDays procedure in the BeforeUpdate event
[quoted text clipped - 13 lines]
> help.
> Jake
Jake - 24 Sep 2006 23:18 GMT
I see what you mean. But I get a runtime error now:
"With object must be user-defined type, object or variant"
Is this because I declared Days as a string in my procedure:
Public Sub ValidateWorkingDays(Days As String, Cancel As Boolean)
thanks!
> Is Days the argument in the ValidateWorkingDays procedure? If so, Me is not
> needed as it should be used in the call
[quoted text clipped - 28 lines]
> > help.
> > Jake
Bob Phillips - 25 Sep 2006 07:16 GMT
Yes that would give an error it should be
Public Sub ValidateWorkingDays(Days As Object, Cancel As Boolean)
or
Public Sub ValidateWorkingDays(Days As MSForms.TextBox, Cancel As Boolean)

Signature
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
> I see what you mean. But I get a runtime error now:
> "With object must be user-defined type, object or variant"
[quoted text clipped - 34 lines]
> > > help.
> > > Jake