Jump: Search for: 

Free Resources from FMS

 

Thank you! Thank you! I just finished reading this document, which was part of a link in the recent Buzz newsletter. I have printed it for others to read, especially those skeptical on the powers of Access and its capabilities.

Darren D.

 

 

 

 

Using a RecordsetClone with Microsoft Access Subforms

Provided by: FMS Development Team

Using 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.

Return to the tips page

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright © 2010 FMS, Inc., Vienna, Virginia
Celebrating 24 Years of Software Excellence