Private Sub cmdAssignCounselor_Click()
Dim intName As Integer
Dim strName As String
Dim strCounselor As String
If Trim(txtStudentName.Text) = vbNullString Then
MsgBox "Please enter student name"
txtStudentName.SetFocus
Exit Sub
End If
strName = UCase(txtStudentName.Text)
strName = Mid(strName, 1, 1)
intName = Asc(strName)
strName = Chr$(intName)
If Not strName > "@" Then
MsgBox "Please enter student name"
txtStudentName.SetFocus
Exit Sub
End If
If intName < Asc("G") Then
strCounselor = "Andy Flemming"
ElseIf intName < Asc("M") Then
strCounselor = "George Larson"
ElseIf intName < Asc("S") Then
strCounselor = "Mary Reynolds"
Else
strCounselor = "Susan Ziegler"
End If
lblCounselor.Caption = strCounselor
txtStudentName.SetFocus
End Sub