I have a main form with a unbound combo box (FindID). A user can select a person from the combo list and retieve the record. Limit to List is Yes. Row Source:
SELECT tblTeacher.ID, tblTeacher.Surname, tblTeacher.Given, tblTeacher.Email FROM tblTeacher ORDER BY [Surname], [Given];
If the person is not in the list, there is an option button to call a pop-up form to add the new persons's details. The pop-up is then closed. On the main form, I have the following code attached to the "FindID" combo box:
Private Sub FindID_GotFocus()
Me.FindID.Requery
End Sub
When I click on the combo box (Got Focus) and type in or scroll, to select the newly entered name, the combo box finds the new name in the list using the following code:
Private Sub FindID_AfterUpdate()
Me.RecordsetClone.FindFirst "ID = " & Me!FindID
If Me.RecordsetClone.NoMatch Then
MsgBox Me!FindID & "Not Found"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
However, it also returns an error message saying "534 Not Found" 534 is the ID of the new record. The new name has been added to the list. Examining the table, the new record is present - hence the new autonumber ID (534 in this case) but the form will not retieve the record.
If I exit the form and come back in, the new record is present and works correctly.
SELECT tblTeacher.ID, tblTeacher.Surname, tblTeacher.Given, tblTeacher.Email FROM tblTeacher ORDER BY [Surname], [Given];
If the person is not in the list, there is an option button to call a pop-up form to add the new persons's details. The pop-up is then closed. On the main form, I have the following code attached to the "FindID" combo box:
Private Sub FindID_GotFocus()
Me.FindID.Requery
End Sub
When I click on the combo box (Got Focus) and type in or scroll, to select the newly entered name, the combo box finds the new name in the list using the following code:
Private Sub FindID_AfterUpdate()
Me.RecordsetClone.FindFirst "ID = " & Me!FindID
If Me.RecordsetClone.NoMatch Then
MsgBox Me!FindID & "Not Found"
Else
Me.Bookmark = Me.RecordsetClone.Bookmark
End If
End Sub
However, it also returns an error message saying "534 Not Found" 534 is the ID of the new record. The new name has been added to the list. Examining the table, the new record is present - hence the new autonumber ID (534 in this case) but the form will not retieve the record.
If I exit the form and come back in, the new record is present and works correctly.