G
Guest
I'm a new user, so please bear with me, because I'm
certain this is a very simple question.
I created a table to log who enters my database.
I wrote the following code, and put it on the open event
for my database startup form.
I want to capture the date/time and username of each
person as they enter the database. This code works except
it writes over the only record in the table everytime. I
need to know how to move to the end of the table and add a
record for each time someone enters.
Can someone please help.
Here's the Code:
Private Sub Form_Open(Cancel As Integer)
Dim rs As DAO.Recordset
Dim UseDate As Date
Dim User As String
UseDate = Now()
User = CurrentUser()
Set rs = DBEngine(0)(0).OpenRecordset("Usage Log",
dbOpenDynaset)
With rs
.Edit
![LogOnDate] = UseDate
![LogOnUser] = User
.Update
End With
rs.Close
Set rs = Nothing
End Sub
certain this is a very simple question.
I created a table to log who enters my database.
I wrote the following code, and put it on the open event
for my database startup form.
I want to capture the date/time and username of each
person as they enter the database. This code works except
it writes over the only record in the table everytime. I
need to know how to move to the end of the table and add a
record for each time someone enters.
Can someone please help.
Here's the Code:
Private Sub Form_Open(Cancel As Integer)
Dim rs As DAO.Recordset
Dim UseDate As Date
Dim User As String
UseDate = Now()
User = CurrentUser()
Set rs = DBEngine(0)(0).OpenRecordset("Usage Log",
dbOpenDynaset)
With rs
.Edit
![LogOnDate] = UseDate
![LogOnUser] = User
.Update
End With
rs.Close
Set rs = Nothing
End Sub