Вы находитесь на странице: 1из 1

' ukljuciti ADO: referenca Microsoft ActiveX Data Objects x.

x Library

Private Sub Command4_Click()

Dim cn As New ADODB.Connection


Dim rs As New ADODB.Recordset
Dim str_SQL As String

Set cn = CurrentProject.AccessConnection

str_SQL = "SELECT * from LogIn WHERE UserName='" & txt_UN & "' AND Password='" &
txt_Pass & "'"
rs.Open str_SQL, cn, adOpenStatic

' MsgBox rs.RecordCount

If rs.RecordCount = 0 Then
MsgBox "Pokusajte ponovo"
txt_UN = ""
txt_Pass = ""
Exit Sub
End If

If rs!prava = "admin" Then


DoCmd.OpenForm "osnovni meni"
DoCmd.Close acForm, "frm_LogIn"
End If

If rs!prava = "korisnik" Then


DoCmd.OpenForm "korisnici"
DoCmd.Close acForm, "frm_LogIn"
End If

End Sub

NAPOMENA:

sta ako su UserName i Password:


' or '1'='1

Вам также может понравиться