I am trying to make it so that a client's last name cannot be blank on a userform.

I think i am close to getting it to work properly... but I keep getting a "Subscript out of range" error. Any thoughts on what I am doing wrong??



Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
    If Len(Me.TextBox1.Value) = 0 Then
        Me.TextBox1.SetFocus
        MsgBox "Last Name cannot be Blank"
        Exit Sub
    End If
End Sub