Okay, I've got this narrowed down just a bit more. I converted the data in my combo box (the user name) to a string and called it into my table (same thing with the time stamp). Now, when I click the logon button, a record is made in the Log Time table with a User and a Time In. The Time Out, however is another problem. When they click the Login Button, the login form creates a record and then closes. How do I make a logout record since the data from the user name combo box is erased once the form is closed. Here is an example of what I'm trying to do.
Private Sub cmdLogin_Click()
Dim strLoginDate As String
strLoginDate = Now()
Dim rst As DAO.Recordset
'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("txtPassword", "tblUsers", _
"[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
Me.cboEmployee.SetFocus
Dim strEmployee As String
strEmployee = cboEmployee.Text
'Close logon form and open splash screen
Set rst = CurrentDb.OpenRecordset("tblLogTime", , dbAppendOnly)
rst.AddNew
rst![User] = strEmployee
rst![TimeIn] = strLoginDate
rst.Update
rst.Close
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "Splash Form"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.txtPassword.SetFocus
End If
End Sub
The above code works for getting me the Name and Time In in my Log Time table. I don't know what to do next to get the Time Out stored in the same table with that person's name. I know I'm close to getting there, I just don't know what's next. Any help is greatly appreciated.