Sei sulla pagina 1di 4

PRINCIPALS DIARY SOURCE CODE FORM 1(LOG IN FORM)

CODE Private Sub Command1_Click() cn.Open GetConnection With rs .CursorLocation = adUseClient

.Open "SELECT pswd,usnm FROM login ", cn, adOpenDynamic, adLockOptimistic

If .EOF = False Then

For i = 0 To .RecordCount - 1

If Text1.Text = !usnm Then If Text2.Text = !pswd Then

Form2.Show Form1.Hide Else MsgBox "Wrong Password.", vbCritical, "Authentication Error" Text2.Text = "" Text2.SetFocus End If Else MsgBox "Incorrect UserName.", vbCritical, "Authentication Error" Text1.Text = "" Text1.SetFocus .MoveNext End If

Next i

End If

.Close: Set rs = Nothing

cn.Close: Set cn = Nothing End With Text3.Text = DateValue(Now) cn.Open GetConnection With rs .CursorLocation = adUseClient

.Open "SELECT * FROM remin WHERE dt='" & Text3.Text & "'", cn, adOpenDynamic, adLockOptimistic For i = 0 To .RecordCount - 1 If .EOF = False Then Text4.Text = !tm + " " + !dt + " " + !re

If Text4.Text <> "" Then

Form12.Show End If End If .MoveNext Next i .Close: Set rs = Nothing

cn.Close: Set cn = Nothing End With

End Sub Private Sub Command2_Click() Form11.Show End Sub Private Sub Data1_Validate(Action As Integer, Save As Integer) End Sub Private Sub Form_Unload(Cancel As Integer)End End Sub

Potrebbero piacerti anche