Hello All,
I am building my first database for a friends salon buisness. He has requested that the database log's everybody logging in and out and the times so he can monitor this for irregularities.
I have this code to the Log In button on the main form.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblloginlog", dbOpenDynaset)
With rst
.AddNew
![Users Name] = Me.firstname
![Time Logged In] = Now()
.Update
End With
Which works fine!
I have several Log Out buttons, on each of these buttons there is the following code:
Set rst = dbs.OpenRecordset("tblloginlog", dbOpenDynaset)
With rst
.AddNew
![Time Logged Out] = Now()
.Update
End With
Again this works fine.
The problem I have is that when a user logs in and logs out it creates 2 entries in the table.
Obvioulsy as you may have worked out this is always going to happen with the above method!
I would like to combine the logging in and logging out times so I can display it better on a form.
Does anybody have any tips, perhaps I am going about things the wrong way? Is there a line of code which has the ability to move my logging out time to an existing entry?
Any help would be very appreciated.
John (Finchy) Finch
I am building my first database for a friends salon buisness. He has requested that the database log's everybody logging in and out and the times so he can monitor this for irregularities.
I have this code to the Log In button on the main form.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblloginlog", dbOpenDynaset)
With rst
.AddNew
![Users Name] = Me.firstname
![Time Logged In] = Now()
.Update
End With
Which works fine!
I have several Log Out buttons, on each of these buttons there is the following code:
Set rst = dbs.OpenRecordset("tblloginlog", dbOpenDynaset)
With rst
.AddNew
![Time Logged Out] = Now()
.Update
End With
Again this works fine.
The problem I have is that when a user logs in and logs out it creates 2 entries in the table.
Obvioulsy as you may have worked out this is always going to happen with the above method!
I would like to combine the logging in and logging out times so I can display it better on a form.
Does anybody have any tips, perhaps I am going about things the wrong way? Is there a line of code which has the ability to move my logging out time to an existing entry?
Any help would be very appreciated.
John (Finchy) Finch