How to Update Data Using Recordset

These days, when couples do not have time for their particular pastimes. tadalafil 40mg The fact cheap viagra cute-n-tiny.com is that the disorder goes on to be worst as and when a person grows old. The foods containing omega-3 fatty acids can improve the functioning of the male sex hormone, testosterone which helps the man perform better. viagra without prescription uk This performs in similar way as the inheriting potentials of this solution are crafted in order purchase female viagra to behave as the angiotensin II receptor blocker.



How to Update Data with RecordSet in MS Access

You can update the existing record using  a recordset. However, the recordset type must not be a snapshot or record is locked. For example, there is a record when the user logged in database. We want to record a logout Time when the user logged out from database. We will capture the logged out time on the last form that is closed.

Code: Update record using Recordset

CurUser = Environ("UserName")
rst.FindLast "UserLoginID =  '" & CurUser & "'"
rst.Edit
     rst!LogOutTime = Now()
rst.Update

Call a function under the Form Close Event or when program is closing.

Private Sub Form_Close()
    Call LogUserOff
End Sub

Complete Function Code:

update full code

After the form is loaded, the information for UserLoginID and LoginTime will be added into a table as shown in the picture below. It will be blank on field “LogOutTime” since the user still logged in.

Log in time

After the form is closed, the current logout time will be updated on the field “LogOutTime.” It will update on the record that matches the UserLoginID and has no data on the “LogOutTime” as shown in the picture below.

log out table


Related posts