How to Use Recordset in MS Access

How to Use Recordset A recordset is a data structure that consists of a group of database records, and can either come from a table, query or SQL. Syntax expression .OpenRecordset(Name, Type(Optional), Options(Optional), LockEdit(Optional)) expression A variable that represents a Database object. #1 Set your references versions of Access that are earlier than Access 2000.   Dim rs As DAO.Recordset new version of Access doesn’t need DAO reference Dim rs As Recordset #2 Type of Recordset Dynaset:- A Dynaset is temporary set of data from one or more tables. A…

Read More

How to Update Data Using Recordset

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 =…

Read More

How to Add New Data Using Recordset

Add New Data by Recordset Other than adding a new record by using SQL Insert Into, you can use a recordset method to add a new record into a table. For example, we want to record a User LoginID and login Time when the user successfully logged in on the Login Form or load the first form after opening database. We will add new UserLoginID and current time into a tblLogTimes table. Code: Add new record using Recordset rst.AddNew rst!UserLoginID = CurUser    ‘Current User Login rst!LogInTime = Now() rst.Update Call…

Read More