V
vb_Dumb
I have some code which i will post later that allows users to log in
basically it is based on a table that a form looks too to verify user
and password but i don't have any type of security levels except i
have the shift key disabled, i need all users disabled from typing in
a certian field on a form except one now i don't know VB very well at
all i got the log on and modified it to what I need so please write
out any code if you can here is the code for my log on form thanks in
advance, Dan
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
Me.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 tblEmployees to see if this matches value
chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword",
"tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "switchboard"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly,
"Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please
contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
DoCmd.Quit
Exit_Command11_Click:
Exit Sub
Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click
End Sub
basically it is based on a table that a form looks too to verify user
and password but i don't have any type of security levels except i
have the shift key disabled, i need all users disabled from typing in
a certian field on a form except one now i don't know VB very well at
all i got the log on and modified it to what I need so please write
out any code if you can here is the code for my log on form thanks in
advance, Dan
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
Me.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 tblEmployees to see if this matches value
chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword",
"tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "switchboard"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly,
"Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please
contact your system administrator.", vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click
DoCmd.Quit
Exit_Command11_Click:
Exit Sub
Err_Command11_Click:
MsgBox Err.Description
Resume Exit_Command11_Click
End Sub