Question : After Update event code

The code in the After Update event limit users to 6=7 digits entry. How can I amend the code to allow users entry of digits between 4 and 7, no more, no less.

I am also open to better ideas other than my code.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
Private Sub txtOrderNo_AfterUpdate()
 If IsNull(cboBNo) Or IsNull(txtLNo) Or IsNull(cboWCType) Or IsNull(cboSType) Then
        MsgBox "Please fill in the missing data in the Address Page to Continue !!! "
        Me.txtWorkOrderNo10 = Null
        Forms!frmMain!MyTabControl.Pages("Info").SetFocus
        Exit Sub
        
 ElseIf Not IsNull(cboBNo) And Not IsNull(txtLNo) _
            And Not IsNull(cboWCType) And Not IsNull(cboSType) Then
   
        Me.txtOrderN = Nz(Me.txtOrderNo, "0") 
 
 If Len(Me.txtOrderNo) = 7 Then '<----- LImits to 7 digits entry
        'Do Nothing
        Else
        
        MsgBox "You cant enter value less than 7 Digits OR" & vbCrLf & vbCrLf _
         & "Zero (0) in the Order Field"
         
        Me.txtOrderNo = Null
        Me.txtOrderNo.SetFocus
        End If
    End If
End Sub

Answer : After Update event code

If Len(Me.txtOrderNo) = 7 Then '<----- LImits to 7 digits entry

Change to

If Len(Me.txtOrderNo) > 3 and Len(Me.txtOrderNo) < 8 Then '<----- LImits to 4-7 digits entry
Random Solutions  
 
programming4us programming4us