Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Command1_Click() rs.AddNew store rs.Update MsgBox "update" End Sub Private Sub Command2_Click() rs(0) = Text1 rs(1) = Text2 rs(2) = Text3 rs(3) = Text4 rs(4) = Text5 rs(5) = Text6 rs(6) = Text7 rs(7) = Text8 rs(8) = Text9 rs(9) = Text10 rs.Update MsgBox "modify" End Sub Private Sub Command3_Click() Dim x As Integer x = InputBox("enter the rgno number") rs.MoveFirst rs.Find "rgno=" & x If rs.EOF = False Then view Else MsgBox "record not found" End If End Sub Private Sub Command4_Click() DataReport1.Refresh DataReport1.Show End Sub Private Sub Command5_Click() clear End Sub Private Sub Form_Load() cn.Open "sll2", "scott", "tiger" rs.Open "select * from arn", cn, adOpenDynamic, adLockOptimistic End Sub Public Sub store() rs(0) = Text1 rs(1) = Text2 rs(2) = Text3 rs(3) = Text4 rs(4) = Text5 rs(5) = Text6
rs(6) = rs(7) = rs(8) = rs(9) = End Sub
Text7 Text8 Text9 Text10
Public Sub view() Text1 = rs(0) Text2 = rs(1) Text3 = rs(2) Text4 = rs(3) Text5 = rs(4) Text6 = rs(5) Text7 = rs(6) Text8 = rs(7) Text9 = rs(8) Text10 = rs(9) End Sub Public Sub clear() Text1 = " " Text2 = " " Text3 = " " Text4 = " " Text5 = " " Text6 = " " Text7 = " " Text8 = " " Text9 = " " Text10 = " " End Sub Private Sub Text6_LostFocus() Text7 = Val(Text3) + Val(Text4) + Val(Text5) + Val(Text6) Text8 = Val(Text7 / 4) If Val(Text6) >= 40 And Val(Text5) >= 40 And Val(Text4) >= 40 And Val(Text3) >= 40 Then Text9 = "pass" Else Text9 = "fail" End If If Text8 > 75 Then Text10 = "dist" ElseIf Text > 59 Then Text10 = "first" Else Text10 = "poor" End If End Sub