Question : vba code to go to a clear the content of a text box and move cursor to that text box

After the user clicks the ok button, I want the contents of the of the text box named "Part" to clear and the cursor to move into that text box on my for.  Can someone please help me develop the vba code for this.....Thanks.
Code Snippet:
1:
If MsgBox("Special Character " & Mid(Me.Part, j, 1) & " Exists.  PLEASE RE-TYPE PART NUMBER CORRECTLY!!!", , "Part Number Authentication") = vbOK Then

Answer : vba code to go to a clear the content of a text box and move cursor to that text box

Do it in the BeforeUpdate event and Cancel that event if needed:

Private Sub Part_BeforeUpdate(CAncel as Integer)
Dim j As Integer
For j = 1 To 7
   If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", Mid(Me.Part, j, 1)) = 0 Then
      MsgBox "Special Character " & Mid(Me.Part, j, 1) & " Exists.  PLEASE RE-TYPE PART NUMBER CORRECTLY!!!", , "Part Number Authentication"
        Cancel = True
        Me.Part.Value = ""
      End If
     
   End If
Next

End Sub
Random Solutions  
 
programming4us programming4us