Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following code example uses the RecordsetClone property and the Recordset object to synchronize a recordset's record with the form's current record.
When a company name is selected from a combo box, the FindFirst method is used to locate the record for that company, and the Recordset object's Bookmark property is assigned to the form's Bookmark property, causing the form to display the found record.
Sub SupplierID_AfterUpdate()
Dim rst As Recordset
Dim strSearchName As String
Set rst = Me.RecordsetClone
strSearchName = Str(Me!SupplierID)
rst.FindFirst "SupplierID = " & strSearchName
If rst.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.