ok try this
I havent tested cos i would have to set up combos etc
but it should work. If not just let me know and i will set up a proper test and get back to you
Regards
Stuart
VB Code:
  1. Private Sub cmdProfile_Click()
  2.     Dim Message As String
  3.     Dim StudentAge As Integer 'Changed from String to Integer (number)
  4.     Dim StudentDate As Date
  5.     Dim Grade As String 'added
  6.  
  7.     'Remove this ..... Dim IsDate As Variant
  8.  
  9.     'Use & for strings     ...... remove vbcr
  10.     'Message = txtName.Text & " is a student in the" & lblGrade.Caption
  11.     'You dont need this first one cos u are setting later
  12.  
  13.     Select Case lbl_grade 'Select case is easier to follow for multi ifs
  14.         Case "1": Grade = "First"
  15.         Case "2": Grade = "Second"
  16.         Case "3": Grade = "Third"
  17.         Case "4": Grade = "Fourth"
  18.         Case "5": Grade = "Fifth"
  19.         Case "6": Grade = "Sixth"
  20.     End Select
  21.     Message = txtName.Text & " is a student in the " & Grade & "Grade. "
  22.  
  23.     'Calculate students age
  24.     StudentDate = cboDate.Text & "/" & cboMonth.Text & "/" & lblYear.Caption
  25.     If IsDate(StudentDate) Then
  26.         StudentAge = DateDiff("yyyy", StudentDate, Now())
  27.         If Month(Now) < Val(cboMonth.Text) Then
  28.             StudentAge = StudentAge - 1
  29.         ElseIf Month(Now) = Val(cboMonth.Text) Then
  30.             If Day(Now) < Val(cboDate.Text) Then
  31.                 StudentAge = StudentAge - 1
  32.             End If
  33.         End If
  34.     Else
  35.         MsgBox "Please enter valid date"
  36.         Exit Sub
  37.     End If
  38.  
  39.     If optMale.Value = True Then
  40.         Message = Message & "He is " & StudentAge & " Years Old"
  41.     Else
  42.         Message = Message & "She is " & StudentAge & " Years Old"
  43.     End If
  44.    
  45.     MsgBox Message, vbOKOnly, "Student Profile"
  46. End Sub