Article ID: 109717
Article Last Modified on 1/18/2007
Public Function TestSnapshot()
Dim SS As Recordset
Dim DS As Recordset
Dim DB As Database
Set DB = CurrentDb()
' Create a snapshot and recordset of the Categories table.
Set SS = DB.OpenRecordset("Categories", dbOpenSnapshot)
Set DS = DB.OpenRecordset("Categories", dbOpenDynaset)
' Move to the first record.
SS.MoveFirst
DS.MoveFirst
' Print the contents of the CategoryName and Description
' .. fields from both record sets. CategoryName is a
' .. Text field and Description is a Memo field.
Debug.Print
Debug.Print "Snapshot:"
Debug.Print " CategoryName: " & SS![CategoryName]
' NOTE: In versions 1.x and 2.0, type a space in the Category
' field name.
Debug.Print " Description: " & SS![Description]
Debug.Print "Dynaset:"
Debug.Print " CategoryName: " & DS![CategoryName]
Debug.Print " Description: " & DS![Description]
' Alter the Description and CategoryName fields using
' ... the dynaset.
DS.Edit
DS![Description] = "My Description"
DS![CategoryName] = "My Category"
DS.Update
' Print the new contents of the recordsets.
Debug.Print
Debug.Print "Snapshot:"
Debug.Print " CategoryName: " & SS![CategoryName]
Debug.Print " Description: " & SS![Description]
Debug.Print "Dynaset:"
Debug.Print " CategoryName: " & DS![CategoryName]
Debug.Print " Description: " & DS![Description]
End Function
? TestSnapShot()
Snapshot:
Category Name: Beverages
Description: Soft drinks, coffees, teas, beer, and ale
Dynaset:
Category Name: Beverages
Description: Soft drinks, coffees, teas, beer, and ale
Snapshot:
Category Name: Beverages
Description: My Description
Dynaset:
Category Name: My Category
Description: My Description
Keywords: kbprb kbprogramming KB109717