Extracting Data from a Record

After you’ve located a particular record or records, you may want to extract data to use in your application instead of modifying the underlying source table.

A single field of a record can be copied to a variable of the appropriate data type. The following example extracts data from three fields in the first record in a Recordset object. In this example, strDbPath is the path to the NorthwindTables database:

Dim dbs As Database, rst As Recordset
Dim strFirstName As String, strLastName As String, strTitle As String
 
Set dbs = OpenDatabase(strDbPath)
Set rst = dbs.OpenRecordset("Employees")
With rst
	.MoveFirst
	strFirstName =!FirstName
	strLastName =!LastName
	strTitle =!Title
End With