Hello All,
I have database which should handle a call system for IT.
I have a login screen form with username and password which works fine.
what I would like to do is that:
when the user enter the system with his username and password (from tblUsers) and open a new call (tblCalls) , the frmOpenNewCall will "know" that the user who open the call and belong to the user who entered the system.
the porpose of this is that when user enter the system, the system will know the belonging of the form and can be accossiacte with it.
for example :
frmLoginScreen
UserName:xxx
Password:1234
frmOpenNewCall
1.Call ID ---- 54 (Automatically)
2.Call Type -- Hardware (User will fill)
3.Call Description (User will fill)
4.Call Status (User will fill)
5.UserID-----the user Id that loged in the system( will be automatically updated !)
Here is my Vb code so far:
Option Compare Database
Private Sub Login_Click()
End Sub
Private Sub cboEmployee_AfterUpdate()
txtPassword.SetFocus
End Sub
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblUsers to see if this matches value chosen in combo box
If Me.txtPassword = DLookup("Password", "tblUsers", "ID = '" & Me.cboEmployee.Value & "'") Then
DoCmd.CLOSE acForm, "frmUserLogin", acSaveNo
MsgBox " ! Welcome"
DoCmd.OpenForm "frmUserOperationSelection", acNormal
DoCmd.CLOSE acForm, "frmMainMenu", acSaveNo
'check to see which user loged in the system
'?????????????????????????
'?????????????????????????
'check if usermade wrong password 3 times
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
Else
MsgBox "Invalid Password. Please try again."
End If
End Sub
Private Sub UserName_AfterUpdate()
End Sub
10x in advance...
I have database which should handle a call system for IT.
I have a login screen form with username and password which works fine.
what I would like to do is that:
when the user enter the system with his username and password (from tblUsers) and open a new call (tblCalls) , the frmOpenNewCall will "know" that the user who open the call and belong to the user who entered the system.
the porpose of this is that when user enter the system, the system will know the belonging of the form and can be accossiacte with it.
for example :
frmLoginScreen
UserName:xxx
Password:1234
frmOpenNewCall
1.Call ID ---- 54 (Automatically)
2.Call Type -- Hardware (User will fill)
3.Call Description (User will fill)
4.Call Status (User will fill)
5.UserID-----the user Id that loged in the system( will be automatically updated !)
Here is my Vb code so far:
Option Compare Database
Private Sub Login_Click()
End Sub
Private Sub cboEmployee_AfterUpdate()
txtPassword.SetFocus
End Sub
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblUsers to see if this matches value chosen in combo box
If Me.txtPassword = DLookup("Password", "tblUsers", "ID = '" & Me.cboEmployee.Value & "'") Then
DoCmd.CLOSE acForm, "frmUserLogin", acSaveNo
MsgBox " ! Welcome"
DoCmd.OpenForm "frmUserOperationSelection", acNormal
DoCmd.CLOSE acForm, "frmMainMenu", acSaveNo
'check to see which user loged in the system
'?????????????????????????
'?????????????????????????
'check if usermade wrong password 3 times
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
Else
MsgBox "Invalid Password. Please try again."
End If
End Sub
Private Sub UserName_AfterUpdate()
End Sub
10x in advance...