Help with Login Issue

amunoz94

New member
Local time
Today, 15:06
Joined
Jan 24, 2013
Messages
8
Good morning everyone, I hope I am in the right forum. I downloaded a template on expense reports and love what it has to offer. So I added the login feature to try and make it somewhat secure. Anyways here is my issue. The issue I have is when I open ACCESS database I get two forms pop up. One is the log on and the other is the form that I need to open after login. The log on screen is first and that works but you see the second tab and if you click the tab it opens the form and bypasses the login. I have looked for a macro that would cause it to open and I cannot find one. So I ask you guys how can I turn off this second form from opening at start up, but want the form to open after login. Here is my code I am using.

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 tblAdmins to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("EmpPassword", "tblAdmins", "[EmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open Expense Reports List screen
Me.Visible = False
DoCmd.OpenForm "Expense Reports List"
Exit Sub
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 admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
 
Check the Database Options to see if the form is open on opening the database, and also perhaps stop the tabs from being shown.
 
Trevor, thank you. Figured it was something simple just needed to be pointed in the right direction. Now it works like a champ. Once again thanks.
 
If Me.txtPassword.Value = DLookup("EmpPassword", "tblAdmins", "[EmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value

what is the meaning of "ngMyEmpID" here ?
 

Users who are viewing this thread

Back
Top Bottom