aaromic2000
New Member
- Joined
- Jul 28, 2009
- Messages
- 32
Hi I'm actually trying to capture the system logout time in a field in access. The below formula is I'm using and I'm getting the Compile error. I'm using Access 2010 and exactly which reference object should I chose from tools
Code:
Private Sub Logout_Click()
End_Time.Value = Now()
If MsgBox("No Changes will be allowed further! Are you sure you want to Logout?", vbYesNo) = vbYes Then
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Reports.mdb"
Set rs = New ADODB.Recordset
rs.Open "Attendance", cn, adOpenKeyset, adLockOptimistic, adCmdTable
r = 3
With rs
.AddNew
If LTrim(RTrim(End_Time.Text)) <> "" Then
.Fields("End Time") = End_Time.Text
End If
.Update
End With
r = r + 1
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
Else
If vbNo Then
End If
End Sub
Last edited by a moderator: