|
Using a RecordsetCloneProvided by: FMS Development TeamUsing a RecordsetClone is an easy way to manipulate records on a subform. Often you will use this property to perform an operation, then synchronize the form with the underlying recordset.
For instance: You may want to create a recordsetclone to find a record in a subform, and move the form to the record found. In the example below, we are finding the first record with a matching last name, then move to that record if one is found.
Dim strCriteria As String Dim rstEmployees As Recordset
' Define search criteria strCriteria = "LastName = '" & Me.txtLastName & "'"
Set rstEmployees = Me.subFrmEmployees.Form.RecordsetClone
' Find the first occurrence rstEmployees.FindFirst strCriteria
If rstEmployees.NoMatch Then MsgBox "No match found" Else 'Move to the record on the subform Me.subFrmEmployees.Form.Bookmark = rstEmployees.Bookmark End If
While there are other ways to perform operations on records in a form or subform, using RecordsetClone is by far the fastest and easiest method. |