Dear all,
Please help me i want to check record already exists in database please modify this code please help
Private Sub txtempno_KeyPress(KeyAscii As Integer)
On Error Resume Next
If KeyAscii = 13 Then
btncalculate.SetFocus
rs2.MoveFirst
While rs2.EOF = False
If Val(txtempno.Text) = rs2.Fields!EmpNo Then
txtsub.Text = rs2.Fields!subjects
txtempname.Text = rs2.Fields!TeacherName
Else
If txtempno.Text = nul Then
MsgBox "Please enter StudentID!", vbOKOnly + vbInformation, "EXCELLENT ACADMY"
txtempno.SetFocus
Exit Sub
End If
End If
rs2.MoveNext
Wend
End If
End Sub