The next example uses the Recordset property and the Recordset object to synchronize a recordset with the form's current record. This step opens the definition of my new table - think of it as opening the table in design view - and creates a new field (called RandomNumber) of the correct data type for the data I am going to put into it When a company name is selected from a combo box, the FindFirst method is used to locate the record for that company, causing the form to display the found record.
Code:
Sub SupplierID_AfterUpdate()
Dim rst As DAO.Recordset
Dim strSearchName As String
Set rst = Me.Recordset
strSearchName = CStr(Me!SupplierID)
rst.FindFirst "SupplierID = " & strSearchName
If rst.NoMatch Then
MsgBox "Record not found"
End If
rst.Close
End Sub
Bookmarks