D
Downie
users Table has
id
username
password
role
The Enters username password on Login form and clicks the Login Button
(Command53)
Private Sub Command53_Click()
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
Set cnn = CurrentProject.Connection
Set cmd.ActiveConnection = cnn
SQLString = "SELECT users.username, users.role FROM [users] WHERE
(((users.username) = " & """" & Login.Value & """" & ") AND
((users.password) = " & """" & Password.Value & """" & "));"
' MsgBox (SQLString)
cmd.CommandText = SQLString
rst.CursorLocation = adUseClient
rst.Open cmd, , adOpenKeyset, adLockOptimistic
MsgBox (rst.GetString)
If rst.RecordCount > 0 Then
DoCmd.OpenForm "MAIN"
Else
MsgBox ("Invalid Username / Password")
End If
End Sub
There are 4 buttons on the MAIN Form.
Based on what the user login "role" is enabls certain buttons.
Any suggestions??
id
username
password
role
The Enters username password on Login form and clicks the Login Button
(Command53)
Private Sub Command53_Click()
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As New ADODB.Recordset
Set cnn = CurrentProject.Connection
Set cmd.ActiveConnection = cnn
SQLString = "SELECT users.username, users.role FROM [users] WHERE
(((users.username) = " & """" & Login.Value & """" & ") AND
((users.password) = " & """" & Password.Value & """" & "));"
' MsgBox (SQLString)
cmd.CommandText = SQLString
rst.CursorLocation = adUseClient
rst.Open cmd, , adOpenKeyset, adLockOptimistic
MsgBox (rst.GetString)
If rst.RecordCount > 0 Then
DoCmd.OpenForm "MAIN"
Else
MsgBox ("Invalid Username / Password")
End If
End Sub
There are 4 buttons on the MAIN Form.
Based on what the user login "role" is enabls certain buttons.
Any suggestions??